From: Ian Lynagh Date: Tue, 4 Sep 2007 13:41:40 +0000 (+0000) Subject: Remove some incorrect rules; fixes #1658: CSE [of Doubles] changes semantics X-Git-Tag: 2007-09-13~2 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=2ec02ba43467f2ca34378c7f62f78bd0626cad33;p=ghc-base.git Remove some incorrect rules; fixes #1658: CSE [of Doubles] changes semantics --- diff --git a/GHC/Base.lhs b/GHC/Base.lhs index baf2694..5c33176 100644 --- a/GHC/Base.lhs +++ b/GHC/Base.lhs @@ -919,14 +919,26 @@ gtInt, geInt, eqInt, neInt, ltInt, leInt :: Int -> Int -> Bool "plusDouble x 0.0" forall x#. (+##) x# 0.0## = x# "plusDouble 0.0 x" forall x#. (+##) 0.0## x# = x# "minusDouble x 0.0" forall x#. (-##) x# 0.0## = x# -"minusDouble x x" forall x#. (-##) x# x# = 0.0## -"timesDouble x 0.0" forall x#. (*##) x# 0.0## = 0.0## -"timesDouble 0.0 x" forall x#. (*##) 0.0## x# = 0.0## "timesDouble x 1.0" forall x#. (*##) x# 1.0## = x# "timesDouble 1.0 x" forall x#. (*##) 1.0## x# = x# "divideDouble x 1.0" forall x#. (/##) x# 1.0## = x# #-} +{- +We'd like to have more rules, but for example: + +This gives wrong answer (0) for NaN - NaN (should be NaN): + "minusDouble x x" forall x#. (-##) x# x# = 0.0## + +This gives wrong answer (0) for 0 * NaN (should be NaN): + "timesDouble 0.0 x" forall x#. (*##) 0.0## x# = 0.0## + +This gives wrong answer (0) for NaN * 0 (should be NaN): + "timesDouble x 0.0" forall x#. (*##) x# 0.0## = 0.0## + +These are tested by num014. +-} + -- Wrappers for the shift operations. The uncheckedShift# family are -- undefined when the amount being shifted by is greater than the size -- in bits of Int#, so these wrappers perform a check and return