From c2e4ffceae34dd1eb2804f17985b63712fe5c49f Mon Sep 17 00:00:00 2001 From: Bob Ippolito Date: Thu, 30 Nov 2006 20:19:46 +0000 Subject: produce inf at runtime git-svn-id: http://simplejson.googlecode.com/svn/trunk@34 a4795897-2c25-0410-b006-0d3caba88fa1 --- simplejson/encoder.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/simplejson/encoder.py b/simplejson/encoder.py index 1f758e9..358521e 100644 --- a/simplejson/encoder.py +++ b/simplejson/encoder.py @@ -19,18 +19,15 @@ ESCAPE_DCT = { for i in range(0x20): 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): # 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. - # assume this produces an infinity on all machines (probably not guaranteed) - INFINITY = 1e66666 - if o != o: text = 'NaN' - elif o == 1.0: - assert o != INFINITY - return '1.0' elif o == INFINITY: text = 'Infinity' elif o == -INFINITY: -- cgit v1.2.1