Handle NaN, -Infinity and Infinity in the toRational for Float/Double (#3676)
[ghc-base.git] / GHC / Real.lhs
index 971f276..71d35e6 100644 (file)
@@ -54,9 +54,10 @@ ratioPrec, ratioPrec1 :: Int
 ratioPrec  = 7  -- Precedence of ':%' constructor
 ratioPrec1 = ratioPrec + 1
 
-infinity, notANumber :: Rational
+infinity, notANumber, negativeZero :: Rational
 infinity   = 1 :% 0
 notANumber = 0 :% 0
+negativeZero = 0 :% (-1)
 
 -- Use :%, not % for Inf/NaN; the latter would 
 -- immediately lead to a runtime error, because it normalises.