From 240b771f655b0ee270fc12ce1cd7e36219e483b7 Mon Sep 17 00:00:00 2001 From: simonm Date: Mon, 1 Feb 1999 14:31:34 +0000 Subject: [PATCH] [project @ 1999-02-01 14:31:34 by simonm] Fix two bugs in formatRealFloat. --- ghc/lib/std/PrelNumExtra.lhs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- 1.7.10.4