Has the built in round() function in Python changed between 2.4 and 2.7?
Python 2.4:
Python 2.4.6 (#1, Feb 12 2009, 14:52:44)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> f = 1480.39499999999998181010596454143524169921875
>>> round(f,2)
1480.4000000000001
>>>
Python 2.7:
Python 2.7.1 (r271:86832, May 13 2011, 08:14:41)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> f = 1480.39499999999998181010596454143524169921875
>>> round(f, 2)
1480.39
>>>
Is there anyway to get the Python 2.4 behaviour back?
I'm aware that the right answer is of course to use the decimal arithmetic module. Unfortunately, this probably isn't an option at this point given time limitations.
Update
For context i'm comparing values in two systems, one of which uses a decimal representation and the other a floating point one. This may (or may not) be a legitimate difference between the systems which needs to be checked further, so i'll consult users and deal with it at the "reporting" level, rather than at the point I get the data from the systems.
Thanks for your help!