[Python-Dev] pyc files, constant folding and borderline portability issues

Mark Dickinson dickinsm at gmail.com
Mon Apr 6 21:30:57 CEST 2009


[Antoine]
> - Issue #5593: code like 1e16+2.9999 is optimized away and its result stored as
> a constant (again), but the result can vary slightly depending on the internal
> FPU precision.
[Guido]
> I would just not bother constant folding involving FP, or only if the
> values involved have an exact representation in IEEE binary FP format.

+1 for removing constant folding for floats (besides conversion
of -<literal>).  There are just too many things to worry about:
FPU rounding mode and precision, floating-point signals and flags,
effect of compiler flags, and the potential benefit seems small.

Mark


More information about the Python-Dev mailing list