Python fails on math

Grant Edwards invalid at invalid.invalid
Thu Feb 24 19:57:17 EST 2011


On 2011-02-25, Westley Mart?nez <anikom15 at gmail.com> wrote:

> Maybe I'm wrong, but wouldn't compiling Python with a compiler that
> supports extended precision for intermediates allow Python to use
> extended precision for its immediates?

I'm not sure what you mean by "immediates", but I don't think so.  For
the C compiler to do an optimization like we're talking about, you
have to give it the entire expression in C for it to compile.  From
the POV of the C compiler, C-Python never does more than one FP
operation at a time when evaluating Python bytecode, and there aren't
any intemediate values to store.

> Or does Python use its own floating-point math?

No, but the C compiler has no way of knowing what the Python
expression is.

-- 
Grant






More information about the Python-list mailing list