Philip Jenvey avatar Philip Jenvey committed 6719c0d

py3 floats round half even

Comments (0)

Files changed (2)


         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"))


         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):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.