Where is the correct round() method?Hmm, I don't have the same result in python2.6, I suspect it's a floating
Hello,
I need a round function that _always_ rounds to the higher integer if
the argument is equidistant between two integers. In Python 3.0, this
is not the advertised behavior of the built-in function round() as
seen below:>>round(0.5)
0
>>round(1.5)
2
>>round(2.5)
2
point precision problem, try just to type "0.5" in the console to see the
exact representation of this value on your system, it may be just over or
just down by a small quantity.
On mine with 2.6 this typically give :
...[26]: 0.5>>>[26]: 0.5
...[27]: 0.4899999999999 9999>>>[27]: 0.49
...[29]: 0.5100000000000 0001>>>[29]: 0.51
...[28]: 1.1000000000000 001>>>[28]: 1.1
...[35]: 1.0>>>[35]: round(0.5)
--
_____________
Maric Michaud