From: simonm Date: Mon, 1 Feb 1999 14:31:34 +0000 (+0000) Subject: [project @ 1999-02-01 14:31:34 by simonm] X-Git-Tag: Approximately_9120_patches~6647 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=240b771f655b0ee270fc12ce1cd7e36219e483b7;p=ghc-hetmet.git [project @ 1999-02-01 14:31:34 by simonm] Fix two bugs in formatRealFloat. --- diff --git a/ghc/lib/std/PrelNumExtra.lhs b/ghc/lib/std/PrelNumExtra.lhs index 265f76c..4ab38ed 100644 --- a/ghc/lib/std/PrelNumExtra.lhs +++ b/ghc/lib/std/PrelNumExtra.lhs @@ -714,7 +714,7 @@ data FFFormat = FFExponent | FFFixed | FFGeneric --no need: deriving (Eq, Ord, S formatRealFloat :: (RealFloat a) => FFFormat -> Maybe Int -> a -> String formatRealFloat fmt decs x | isNaN x = "NaN" - | isInfinite x && x < 0 = if x < 0 then "-Infinity" else "Infinity" + | isInfinite x = if x < 0 then "-Infinity" else "Infinity" | x < 0 || isNegativeZero x = '-':doFmt fmt (floatToDigits (toInteger base) (-x)) | otherwise = doFmt fmt (floatToDigits (toInteger base) x) where @@ -731,7 +731,7 @@ formatRealFloat fmt decs x Nothing -> let e' = if e==0 then 0 else e-1 in (case ds of - [d] -> d : ".0e" ++ show e' + [d] -> d : ".0e" (d:ds') -> d : '.' : ds' ++ "e") ++ show e' Just dec -> let dec' = max dec 1 in