X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=GHC%2FFloat.lhs;h=dbb556fe50083e46c987a7a874647cc83fd7911e;hb=df1779036dfeb32a774ff212e3267fcdd2dab890;hp=61d009f70761a6c40c09eb39013650ff2489a597;hpb=1197a106aa33ef1af6402dd4598af5ee4c11a6f4;p=ghc-base.git diff --git a/GHC/Float.lhs b/GHC/Float.lhs index 61d009f..dbb556f 100644 --- a/GHC/Float.lhs +++ b/GHC/Float.lhs @@ -171,10 +171,7 @@ instance Num Float where fromInteger i = F# (floatFromInteger i) instance Real Float where - toRational x | isInfinite x = if x < 0 then -infinity else infinity - | isNaN x = notANumber - | isNegativeZero x = negativeZero - | otherwise = (m%1)*(b%1)^^n + toRational x = (m%1)*(b%1)^^n where (m,n) = decodeFloat x b = floatRadix x @@ -306,10 +303,7 @@ instance Num Double where instance Real Double where - toRational x | isInfinite x = if x < 0 then -infinity else infinity - | isNaN x = notANumber - | isNegativeZero x = negativeZero - | otherwise = (m%1)*(b%1)^^n + toRational x = (m%1)*(b%1)^^n where (m,n) = decodeFloat x b = floatRadix x @@ -719,7 +713,6 @@ fromRat (n :% 0) | n > 0 = 1/0 -- +Infinity fromRat (n :% d) | n > 0 = fromRat' (n :% d) | n < 0 = - fromRat' ((-n) :% d) - | d < 0 = 0/(-1) -- -0.0 | otherwise = encodeFloat 0 0 -- Zero -- Conversion process: