Permalink
Browse files

RFC 4627 section 2.4 forbids encoding of NaN and +/- Infinity.

  • Loading branch information...
bos committed Apr 13, 2011
1 parent 5937504 commit ca130105bc927e28c5576645c3b31e95dcc66eba
Showing with 1 addition and 3 deletions.
  1. +1 −3 Data/Aeson/Encode/Double.hs
@@ -28,9 +28,7 @@ data T = T [Int] {-# UNPACK #-} !Int
double :: Double -> Builder
double f
- | isNaN f = fromByteString "NaN"
- | isInfinite f = fromByteString $
- if f < 0 then "-Infinity" else "Infinity"
+ | isNaN f || isInfinite f = fromByteString "null"
| f < 0 || isNegativeZero f = minus `mappend` goGeneric (floatToDigits (-f))
| otherwise = goGeneric (floatToDigits f)
where

0 comments on commit ca13010

Please sign in to comment.