[issue1869] Builtin round function is sometimes inaccurate for floats

Mark Dickinson report at bugs.python.org
Sat Apr 18 14:27:25 CEST 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

I take that back.  The 2.7 round still has some problems.
Here's one example:

>>> x = 5e15 + 1  # exactly representable as an IEEE 754 double
>>> x
5000000000000001.0
>>> round(x)
5000000000000002.0

Another nit:

>>> round(-0.0, 0)  # should retain the sign of zero
0.0

Reopening.

----------
resolution: fixed -> 
status: closed -> open

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


More information about the Python-bugs-list mailing list