Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r59429:6719c0d71e7c
Date: 2012-12-14 17:20 -0800
http://bitbucket.org/pypy/pypy/changeset/6719c0d71e7c/

Log:    py3 floats round half even

diff --git a/pypy/objspace/std/floattype.py b/pypy/objspace/std/floattype.py
--- a/pypy/objspace/std/floattype.py
+++ b/pypy/objspace/std/floattype.py
@@ -304,7 +304,7 @@
         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"))
diff --git a/pypy/objspace/std/test/test_floatobject.py 
b/pypy/objspace/std/test/test_floatobject.py
--- a/pypy/objspace/std/test/test_floatobject.py
+++ b/pypy/objspace/std/test/test_floatobject.py
@@ -188,6 +188,7 @@
         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):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to