From e085d6eeabd0fd288000d56373ffb645a91fd8ef Mon Sep 17 00:00:00 2001 From: Bob Ippolito Date: Sun, 23 Mar 2008 05:03:55 +0000 Subject: switch back to repr for accuracy git-svn-id: http://simplejson.googlecode.com/svn/trunk@64 a4795897-2c25-0410-b006-0d3caba88fa1 --- simplejson/encoder.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/simplejson/encoder.py b/simplejson/encoder.py index eec9c7f..4a99c12 100644 --- a/simplejson/encoder.py +++ b/simplejson/encoder.py @@ -25,6 +25,7 @@ for i in range(0x20): # assume this produces an infinity on all machines (probably not guaranteed) INFINITY = float('1e66666') +FLOAT_REPR = repr def floatstr(o, allow_nan=True): # Check for specials. Note that this type of test is processor- and/or @@ -37,7 +38,7 @@ def floatstr(o, allow_nan=True): elif o == -INFINITY: text = '-Infinity' else: - return str(o) + return FLOAT_REPR(o) if not allow_nan: raise ValueError("Out of range float values are not JSON compliant: %r" -- cgit v1.2.1