Commits

Philip Jenvey committed 6719c0d

py3 floats round half even

  • Participants
  • Parent commits fe21273
  • Branches py3k

Comments (0)

Files changed (2)

File pypy/objspace/std/floattype.py

         return space.wrap(0.0 * x)
 
     # finite x, and ndigits is not unreasonably large
-    z = rfloat.round_double(x, ndigits)
+    z = rfloat.round_double(x, ndigits, half_even=True)
     if rfloat.isinf(z):
         raise OperationError(space.w_OverflowError,
                              space.wrap("overflow occurred during round"))

File pypy/objspace/std/test/test_floatobject.py

         assert round(123.456, -700) == 0.0
         assert round(123.456, -2**100) == 0.0
         assert math.copysign(1., round(-123.456, -700)) == -1.
+        assert round(2.5, 0) == 2.0
 
     def test_special_float_method(self):
         class a(object):