diff options
author | Bob Ippolito <bob@redivi.com> | 2008-03-23 05:03:55 +0000 |
---|---|---|
committer | Bob Ippolito <bob@redivi.com> | 2008-03-23 05:03:55 +0000 |
commit | e085d6eeabd0fd288000d56373ffb645a91fd8ef (patch) | |
tree | c23df8ae677bae15d4d8fd2ff324045de373031c | |
parent | 59ac2588ac3de835b4789f8975dd346617a5f977 (diff) | |
download | simplejson-e085d6eeabd0fd288000d56373ffb645a91fd8ef.tar.gz |
switch back to repr for accuracy
git-svn-id: http://simplejson.googlecode.com/svn/trunk@64 a4795897-2c25-0410-b006-0d3caba88fa1
-rw-r--r-- | simplejson/encoder.py | 3 |
1 files changed, 2 insertions, 1 deletions
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" |