
Sept. 26, 2012
5:32 p.m.
2012/9/26 M.-A. Lemburg <mal@egenix.com>:
round(2.675, 2) 2.67
So you end up explaining again and again that computing binary approximations to decimal rounds of binary approximations of decimal halfway cases is a bad idea.
But that's the fault of round(), is it ? ;-) It's more one of educating people of what to expect when working with floats.
Could we change the round() behavior? The second parameter is the number of decimal places, so the operation could be defined in terms of decimal digits. A similar change was already done for float.__str__. -- Amaury Forgeot d'Arc