|
@@ -807,7 +807,7 @@ let rec reduce_loop ctx e =
|
|
let e = Type.map_expr (reduce_loop ctx) e in
|
|
let e = Type.map_expr (reduce_loop ctx) e in
|
|
let check_float op f1 f2 =
|
|
let check_float op f1 f2 =
|
|
let f = op f1 f2 in
|
|
let f = op f1 f2 in
|
|
- let fstr = string_of_float f in
|
|
|
|
|
|
+ let fstr = float_repres f in
|
|
if (match classify_float f with FP_nan | FP_infinite -> false | _ -> float_of_string fstr = f) then { e with eexpr = TConst (TFloat fstr) } else e
|
|
if (match classify_float f with FP_nan | FP_infinite -> false | _ -> float_of_string fstr = f) then { e with eexpr = TConst (TFloat fstr) } else e
|
|
in
|
|
in
|
|
sanitize_expr ctx.com (match e.eexpr with
|
|
sanitize_expr ctx.com (match e.eexpr with
|
|
@@ -946,7 +946,7 @@ let rec reduce_loop ctx e =
|
|
| NegBits, TConst (TInt i) -> { e with eexpr = TConst (TInt (Int32.lognot i)) }
|
|
| NegBits, TConst (TInt i) -> { e with eexpr = TConst (TInt (Int32.lognot i)) }
|
|
| Neg, TConst (TFloat f) ->
|
|
| Neg, TConst (TFloat f) ->
|
|
let v = 0. -. float_of_string f in
|
|
let v = 0. -. float_of_string f in
|
|
- let vstr = string_of_float v in
|
|
|
|
|
|
+ let vstr = float_repres v in
|
|
if float_of_string vstr = v then
|
|
if float_of_string vstr = v then
|
|
{ e with eexpr = TConst (TFloat vstr) }
|
|
{ e with eexpr = TConst (TFloat vstr) }
|
|
else
|
|
else
|