[issue17259] Document round half to even rule for floats

Mark Dickinson report at bugs.python.org
Sat Dec 14 09:42:34 CET 2013


Mark Dickinson added the comment:

And the Python 2 behaviour has been essentially unchanged for a long time:

Python 2.4.6 (#1, Nov  7 2013, 16:01:20) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> "%.f %.f" % (0.5, 1.5)
'0 2'
>>> round(0.5), round(1.5)
(1.0, 2.0)

(Though that first call just shows the result of whatever the OS C libraries decide to do, but historically that seems to be more likely to be round-half-to-even than anything else.)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17259>
_______________________________________


More information about the Python-bugs-list mailing list