diff options
| author | Pierre Roux | 2018-08-28 14:31:37 +0200 |
|---|---|---|
| committer | Pierre Roux | 2019-11-01 10:20:31 +0100 |
| commit | 79605dabb10e889ae998bf72c8483f095277e693 (patch) | |
| tree | fd2cf05ce8e4a2748700c7d1458a574f91dbab97 /kernel/float64.ml | |
| parent | dda50a88aab0fa0cfb74c8973b5a4353fe5c8447 (diff) | |
Change return type of primitive float comparison
Replace `option comparison` with `float_comparison` (:= `FEq | FLt |
FGt | FNotComparable`) as suggested by Guillaume Melquiond to avoid
boxing and an extra match when using primitive float comparison.
Diffstat (limited to 'kernel/float64.ml')
| -rw-r--r-- | kernel/float64.ml | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/float64.ml b/kernel/float64.ml index a625c0f551..eebc8f35ef 100644 --- a/kernel/float64.ml +++ b/kernel/float64.ml @@ -24,17 +24,17 @@ let of_float f = f let opp = ( ~-. ) let abs = abs_float -type float_comparison = Eq | Lt | Gt | NotComparable +type float_comparison = FEq | FLt | FGt | FNotComparable let compare x y = - if x < y then Lt + if x < y then FLt else ( - if x > y then Gt + if x > y then FGt else ( - if x = y then Eq - else NotComparable (* NaN case *) + if x = y then FEq + else FNotComparable (* NaN case *) ) ) |
