Message 80875 - Python tracker (original) (raw)
Well that's not what I have learned how rounding works. I think that's the more common way:
0.4 -> 0 0.5 -> 1 0.6 -> 1
I hope you don't try to spread the misbehavoir of pythons way of rounding
print '%.2f' % 2.545 // returns 2.54
to the built in round() function. So that round() would also return 2.54.
The result of rounding 2.545 is 2.55 no matter how python temporarly stores "2.545" and independent of how python does the rounding. The 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 python does stuff wrong then it has a bug.
in my opinion