Mark Dickinson <dicki...@gmail.com> added the comment:

> This is mathematically wrong ...

No, it's not 'mathematically wrong'.  There are many different rounding 
conventions in use, and no single universally agreed convention for rounding 
halfway cases.  Python chooses to use unbiased rounding[1] here, which matches 
the rounding used for all other basic arithmetic operations.

Other comments:

(1) I agree that round-half-up might be a useful convention to have available.  
But...

(2) Depending on any sort of predictable rounding behaviour for *decimal* 
halfway cases when using *binary* floats is fraught with peril.  If you really 
care about these halfway cases going in a particular direction (whether it's 
away from zero, towards +infinity, towards even, towards odd, etc.) then you 
should really be using Decimal.







[1] http://en.wikipedia.org/wiki/Rounding#Round_half_to_even

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13060>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to