From 267d49b5019882d3e65a714c4b924fd04cdb9fd6 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 16 Sep 2015 19:13:34 -0700 Subject: [PATCH] Fix the min and max computation for the case where the operands are equal. --- ml-proto/src/given/float32.ml | 4 ++-- ml-proto/src/given/float64.ml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ml-proto/src/given/float32.ml b/ml-proto/src/given/float32.ml index 3991d56de3..0c2524dcee 100644 --- a/ml-proto/src/given/float32.ml +++ b/ml-proto/src/given/float32.ml @@ -61,7 +61,7 @@ let min x y = let xf = arith_of_bits x in let yf = arith_of_bits y in (* min(-0, 0) is -0 *) - if xf = 0.0 && yf = 0.0 then (Int32.logor x y) else + if xf = yf then Int32.logor x y else if xf < yf then x else if xf > yf then y else nondeterministic_nan @@ -70,7 +70,7 @@ let max x y = let xf = arith_of_bits x in let yf = arith_of_bits y in (* max(-0, 0) is 0 *) - if xf = 0.0 && yf = 0.0 then (Int32.logand x y) else + if xf = yf then Int32.logand x y else if xf > yf then x else if xf < yf then y else nondeterministic_nan diff --git a/ml-proto/src/given/float64.ml b/ml-proto/src/given/float64.ml index da49d36dc8..6ce12bda36 100644 --- a/ml-proto/src/given/float64.ml +++ b/ml-proto/src/given/float64.ml @@ -61,7 +61,7 @@ let min x y = let xf = arith_of_bits x in let yf = arith_of_bits y in (* min(-0, 0) is -0 *) - if xf = 0.0 && yf = 0.0 then (Int64.logor x y) else + if xf = yf then Int64.logor x y else if xf < yf then x else if xf > yf then y else nondeterministic_nan @@ -70,7 +70,7 @@ let max x y = let xf = arith_of_bits x in let yf = arith_of_bits y in (* max(-0, 0) is 0 *) - if xf = 0.0 && yf = 0.0 then (Int64.logand x y) else + if xf = yf then Int64.logand x y else if xf > yf then x else if xf < yf then y else nondeterministic_nan