Skip to content

Commit 94493de

Browse files
committed
fixup! restore Float.equal
1 parent 28f5b98 commit 94493de

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

compiler/lib/code.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,9 @@ module Constant = struct
387387
done;
388388
!same
389389
| Int64 a, Int64 b -> Some (Int64.equal a b)
390-
| Float_array a, Float_array b -> Some (Array.equal Float.equal a b)
390+
| Float_array a, Float_array b -> Some (Array.equal Float.ieee_equal a b)
391391
| Int a, Int b -> Some (Int32.equal a b)
392-
| Float a, Float b -> Some (Float.equal a b)
392+
| Float a, Float b -> Some (Float.ieee_equal a b)
393393
| String _, NativeString _ | NativeString _, String _ -> None
394394
| Int _, Float _ | Float _, Int _ -> None
395395
| Tuple ((0 | 254), _, _), Float_array _ -> None

compiler/lib/eval.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ let the_cont_of info x (a : cont array) =
237237
let constant_js_equal a b =
238238
match a, b with
239239
| Int i, Int j -> Some (Int32.equal i j)
240-
| Float a, Float b -> Some (Float.equal a b)
240+
| Float a, Float b -> Some (Float.ieee_equal a b)
241241
| NativeString a, NativeString b -> Some (Native_string.equal a b)
242242
| String a, String b when Config.Flag.use_js_string () -> Some (String.equal a b)
243243
| Int _, Float _ | Float _, Int _ -> None

compiler/lib/javascript.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ end = struct
112112
| FP_infinite -> if Float.(v < 0.) then "-Infinity" else "Infinity"
113113
| FP_normal | FP_subnormal -> (
114114
let vint = int_of_float v in
115-
if Float.equal (float_of_int vint) v
115+
if Float.ieee_equal (float_of_int vint) v
116116
then Printf.sprintf "%d." vint
117117
else
118118
match
119119
find_smaller
120120
~f:(fun prec ->
121121
let s = float_to_string prec v in
122-
if Float.equal v (float_of_string s) then Some s else None)
122+
if Float.ieee_equal v (float_of_string s) then Some s else None)
123123
~bad:0
124124
~good:18
125125
~good_s:"max"

compiler/lib/stdlib.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,9 @@ end
401401
module Float = struct
402402
type t = float
403403

404-
let equal = Float.equal
404+
let equal (_ : float) (_ : float) = `Use_ieee_equal_or_bitwise_equal
405+
406+
let ieee_equal (a : float) (b : float) = Poly.equal a b
405407

406408
let bitwise_equal (a : float) (b : float) =
407409
Int64.equal (Int64.bits_of_float a) (Int64.bits_of_float b)

0 commit comments

Comments
 (0)