diff --git a/simplejson/_speedups.c b/simplejson/_speedups.c
index 5d33893fdeb45b3c3a348d493f35b7a2ab460ae9_c2ltcGxlanNvbi9fc3BlZWR1cHMuYw==..c484d44d0ac0e89d921a6303024a5d160707a67e_c2ltcGxlanNvbi9fc3BlZWR1cHMuYw== 100644
--- 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
index 5d33893fdeb45b3c3a348d493f35b7a2ab460ae9_c2ltcGxlanNvbi90ZXN0cy90ZXN0X2Zsb2F0LnB5..c484d44d0ac0e89d921a6303024a5d160707a67e_c2ltcGxlanNvbi90ZXN0cy90ZXN0X2Zsb2F0LnB5 100644
--- a/simplejson/tests/test_float.py
+++ b/simplejson/tests/test_float.py
@@ -5,5 +5,5 @@
 
 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)
@@ -9,4 +9,5 @@
             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]: