# HG changeset patch
# User Bob Ippolito <bob@redivi.com>
# Date 1224865809 0
#      Fri Oct 24 16:30:09 2008 +0000
# Node ID c484d44d0ac0e89d921a6303024a5d160707a67e
# Parent  5d33893fdeb45b3c3a348d493f35b7a2ab460ae9
http://code.google.com/p/simplejson/issues/detail?id=27

git-svn-id: http://simplejson.googlecode.com/svn/trunk@148 a4795897-2c25-0410-b006-0d3caba88fa1

diff --git a/simplejson/_speedups.c b/simplejson/_speedups.c
--- a/simplejson/_speedups.c
+++ b/simplejson/_speedups.c
@@ -1178,7 +1178,7 @@
     if (idx < end_idx && str[idx] == '.' && str[idx + 1] >= '0' && str[idx + 1] <= '9') {
         is_float = 1;
         idx += 2;
-        while (idx < end_idx && str[idx] >= '0' && str[idx] <= '9') idx++;
+        while (idx <= end_idx && str[idx] >= '0' && str[idx] <= '9') idx++;
     }
 
     /* if the next char is 'e' or 'E' then maybe read the exponent (or backtrack) */
diff --git a/simplejson/tests/test_float.py b/simplejson/tests/test_float.py
--- a/simplejson/tests/test_float.py
+++ b/simplejson/tests/test_float.py
@@ -5,8 +5,9 @@
 
 class TestFloat(TestCase):
     def test_floats(self):
-        for num in [1617161771.7650001, math.pi, math.pi**100, math.pi**-100]:
+        for num in [1617161771.7650001, math.pi, math.pi**100, math.pi**-100, 3.1]:
             self.assertEquals(float(S.dumps(num)), num)
+            self.assertEquals(S.loads(S.dumps(num)), num)
 
     def test_ints(self):
         for num in [1, 1L, 1<<32, 1<<64]: