[Python-Dev] Return type of round, floor, and ceil in 2.6

Raymond Hettinger python at rcn.com
Fri Jan 4 23:45:34 CET 2008


[GvR to Tim]
> Do you have an opinion as to whether we should 
> adopt round-to-even at all (as a default)?

For the sake of other implementations (Jython, etc) and for ease of reproducing the results with other tools (Excel, etc), the simplest choice is int(x+0.5).  That works everywhere, it is easy to explain, it runs fast, and it is not hard to get right.

my two cents,

Raymond


More information about the Python-Dev mailing list