Rounding a number to nearest even

Duncan Booth duncan.booth at invalid.invalid
Tue Apr 15 11:47:27 CEST 2008


Chris <cwitts at gmail.com> wrote:

> even is closer to even.75 than even+1.25.  Why should it be rounded
> up ?

Because the OP wants to round values to the nearest integer. Only values of 
the form 'x.5' which have two nearest values use 'nearest even' to 
disambiguate the result.

See http://en.wikipedia.org/wiki/Rounding#Round-to-even_method

That's the way I was taught to round numbers when at primary school.




More information about the Python-list mailing list