[Python-Dev] Nondeterministic long-to-float coercion
Raymond Hettinger
rhettinger at ewtllc.com
Thu Oct 19 23:22:59 CEST 2006
> I noticed that you used both "nondeterministic" and
> "reproducible" though.
LOL. The nondeterministic part is that the same calculation will give
different answers and there doesn't appear to be a pattern to which of
the several answers will occur. The reproducible part is that it
happens from session-to-session
> Are the specific values significant (e.g., do
> you really need range(10000) to demonstrate the problem)?
No, you just need to run the calculation several times at the command
line:
>>> -19400000000 * (1/100.0)
-193994880.0
>>> -19400000000 * (1/100.0)
-194000000.0
>>> -19400000000 * (1/100.0)
-194000000.0
Raymond
-----Original Message-----
From: skip at pobox.com [mailto:skip at pobox.com]
Sent: Thursday, October 19, 2006 1:44 PM
To: Raymond Hettinger
Cc: python-dev at python.org
Subject: Re: [Python-Dev] Nondeterministic long-to-float coercion
Raymond> My colleague got an odd result today that is reproducible
on
Raymond> his build of Python (RedHat's distribution of Py2.4.2) but
not
Raymond> any other builds I've checked (including an Ubuntu Py2.4.2
Raymond> built with a later version of GCC). I hypothesized that
this
Raymond> was a bug in the underlying GCC libraries, but the
magnitude of
Raymond> the error is so large that that seems implausible. Does
anyone
Raymond> have a clue what is going-on?
Not off the top of my head (but then I'm not a guts of the
implementation or
gcc whiz). I noticed that you used both "nondeterministic" and
"reproducible" though. Does your colleague always get the same result?
If
you remove the set constructor do the oddball values always wind up in
the
same spots on repeated calls? Are the specific values significant
(e.g., do
you really need range(10000) to demonstrate the problem)? Also, I can
never
remember exactly, but are even-numbered minor numbers in GCC releases
supposed to be development releases (or is that for the Linux kernel)?
Just a few questions that come to mind.
Skip
More information about the Python-Dev
mailing list