[Python-Dev] Return type of round, floor, and ceil in 2.6 (original) (raw)
Guido van Rossum guido at python.org
Fri Jan 4 18:05:43 CET 2008
- Previous message: [Python-Dev] Return type of round, floor, and ceil in 2.6
- Next message: [Python-Dev] Return type of round, floor, and ceil in 2.6
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Jan 4, 2008 8:58 AM, <skip at pobox.com> wrote:
Guido> Looks like in Python 2.6, round(0.5) right now returns 0.0, Guido> whereas in 2.5, it returns 1.0. Guido> I think it should return 1.0, for best compatibility with Python Guido> 2.5. And for best compatibility with everything else! <0.5 wink>
Should I round that to 0 whole winks or 1 whole wink?
Rounding 0.5 to 0 is a new fad, called round-to-even, or statistician's rounding. Read http://en.wikipedia.org/wiki/Rounding . It's a standard, and more correct when doing statistical calculations. That's why we've chosen it for Python 3.0. But it should not bleed into Python 2.6.
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] Return type of round, floor, and ceil in 2.6
- Next message: [Python-Dev] Return type of round, floor, and ceil in 2.6
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]