Skip to content
Snippets Groups Projects
Commit c480a37b14c8 authored by Bob Ippolito's avatar Bob Ippolito
Browse files

produce inf at runtime

git-svn-id: http://simplejson.googlecode.com/svn/trunk@34 a4795897-2c25-0410-b006-0d3caba88fa1
parent f625396d13bc
Branches
Tags
No related merge requests found
...@@ -19,7 +19,10 @@ ...@@ -19,7 +19,10 @@
for i in range(0x20): for i in range(0x20):
ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,)) ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,))
# assume this produces an infinity on all machines (probably not guaranteed)
INFINITY = float('1e66666')
def floatstr(o, allow_nan=True): def floatstr(o, allow_nan=True):
# Check for specials. Note that this type of test is processor- and/or # Check for specials. Note that this type of test is processor- and/or
# platform-specific, so do tests which don't depend on the internals. # platform-specific, so do tests which don't depend on the internals.
...@@ -22,9 +25,6 @@ ...@@ -22,9 +25,6 @@
def floatstr(o, allow_nan=True): def floatstr(o, allow_nan=True):
# Check for specials. Note that this type of test is processor- and/or # Check for specials. Note that this type of test is processor- and/or
# platform-specific, so do tests which don't depend on the internals. # platform-specific, so do tests which don't depend on the internals.
# assume this produces an infinity on all machines (probably not guaranteed)
INFINITY = 1e66666
if o != o: if o != o:
text = 'NaN' text = 'NaN'
...@@ -29,8 +29,5 @@ ...@@ -29,8 +29,5 @@
if o != o: if o != o:
text = 'NaN' text = 'NaN'
elif o == 1.0:
assert o != INFINITY
return '1.0'
elif o == INFINITY: elif o == INFINITY:
text = 'Infinity' text = 'Infinity'
elif o == -INFINITY: elif o == -INFINITY:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment