Commits

Bryan O'Sullivan  committed 0e957b2

Handle Infinity and NaN more compatibly.

  • Participants
  • Parent commits 44b9571
  • Tags 0.2.0.2

Comments (0)

Files changed (1)

File Blaze/Text/Double/Native.hs

 
 double :: Double -> Builder
 double f
-    | isNaN f || isInfinite f   = fromByteString "null"
+    | isInfinite f              = fromByteString $
+                                  if f > 0 then "Infinity" else "-Infinity"
     | f < 0 || isNegativeZero f = minus `mappend` goGeneric (floatToDigits (-f))
-    | otherwise                 = goGeneric (floatToDigits f)
+    | f >= 0                    = goGeneric (floatToDigits f)
+    | otherwise                 = fromByteString "NaN"
   where
    goGeneric p@(T _ e)
      | e < 0 || e > 7 = goExponent p