[Python-Dev] pyc files, constant folding and borderline portability issues
Adam Olsen
rhamph at gmail.com
Tue Apr 7 00:05:58 CEST 2009
On Mon, Apr 6, 2009 at 2:22 PM, Mark Dickinson <dickinsm at gmail.com> wrote:
> Well, I'd say that the obvious solution here is to compute
> the constant 2.0**53 just once, somewhere outside the
> inner loop. In any case, that value would probably be better
> written as 2.0**DBL_MANT_DIG (or something similar).
>
> As Antoine reported, the constant-folding caused quite
> a confusing bug report (issue #5593): the problem (when
> we eventually tracked it down) was that the folded
> constant was in a .pyc file, and so wasn't updated when
> the compiler flags changed.
Another way of looking at this is that we have a ./configure option
which affects .pyc output. Therefor, we should add a flag to the
magic number, causing it to be regenerated as needed.
Whether that's better or worse than removing constant folding I
haven't decided. I have such low expectations of floating point that
I'm not surprised by bugs like this. I'm more surprised that people
expect consistent, deterministic results...
--
Adam Olsen, aka Rhamphoryncus
More information about the Python-Dev
mailing list