Hi there.
I just hit a problem in my company, in the process of upgrading from stackless 
2.5 to 2.7.
Some rounding code, that was (foolishly) using "%.*f" string formatting to 
achieve floating point rounding started providing different results from 
before.  I explained this away to QA and Developement as a) you shouldn't do 
that, and b) string representation of floats became better and "more correct" 
in 2.7.  For UI rounding, I directed them to the Decimal module.

So far so good.

But it appears that the builtin round() method also changed.  Whereas I see the 
changing of floating point representation in string formatting as not being 
very serious, why did the arithmetic function round() have to change?  I don't 
see this mentioned in the release notes and was initially a bit puzzled by it.  
Hasn't anyone else been hit by the discrepancy?

(and, yes, I know it is now more correct, as seen by round(5.55, 1)  (5.6 in 
py2.5, 5.5 in py 2.7 which is correct since 5.55 is actually 5.549999... )

Perhaps the release notes need updating?

K


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to