[Python-Dev] Nondeterministic long-to-float coercion (original) (raw)

Raymond Hettinger rhettinger at ewtllc.com
Thu Oct 19 22:07:31 CEST 2006


My colleague got an odd result today that is reproducible on his build of Python (RedHat's distribution of Py2.4.2) but not any other builds I've checked (including an Ubuntu Py2.4.2 built with a later version of GCC). I hypothesized that this was a bug in the underlying GCC libraries, but the magnitude of the error is so large that that seems implausible. Does anyone have a clue what is going-on?

Raymond


Python 2.4.2 (#1, Mar 29 2006, 11:22:09) [GCC 4.0.2 20051125 (Red Hat 4.0.2-8)] on linux2 Type "help", "copyright", "credits" or "license" for more information.

set(-19400000000 * (1/100.0) for i in range(10000)) set([-194000000.0, -193995904.0, -193994880.0])



More information about the Python-Dev mailing list