[issue5118] '%.2f' % 2.545 doesn't round correctly

Mark Dickinson report at bugs.python.org
Sat Jan 31 17:05:48 CET 2009


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

> result is 2.55 and not 2.54. If python doesn't deliver "2.55" as the
> result of it's rounding algorithm then it's doing it wrong. And if

Sorry, but that's just not true.  I suggest that you (a) read the 
section on floating-point[1] in the Python tutorial, and/or (b) ask 
about this on comp.lang.python if you feel inclined---there are plenty 
of people there who would be glad to explain what's going on here.

[1] http://docs.python.org/tutorial/floatingpoint.html

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


More information about the Python-bugs-list mailing list