[docs] question on description

Alexander Heger alex at physics.umn.edu
Fri Aug 13 06:28:52 CEST 2010


http://docs.python.org/library/stdtypes.html

lists in 5.4.:

"round(x[, n]) 	x rounded to n digits, rounding half to even. If n is 
omitted, it defaults to 0."

what does "rounding half to even" mean?

In [141]: round(1.5)
Out[141]: 2.0

In [142]: round(0.5)
Out[142]: 1.0


I should have expected (IEEE)

In [141]: round(1.5)
Out[141]: 2.0

In [142]: round(0.5)
Out[142]: 0.0


-Alexander


More information about the docs mailing list