[pypy-dev] Contributing to pypy [especially numpy]

Alex Gaynor alex.gaynor at gmail.com
Sun Oct 16 23:25:23 CEST 2011


On Sun, Oct 16, 2011 at 5:21 PM, Armin Rigo <arigo at tunes.org> wrote:

> Hi David,
>
> On Sun, Oct 16, 2011 at 19:13, David Cournapeau <cournape at gmail.com>
> wrote:
> > (...) and there is also the issue
> > of correctness in floating point code generation. Given that
> > decade-old compilers get it wrong, I would expect pypy jit to have
> > quite a few funky corner cases as well.
>
> No, we should not have corner cases, because we don't go there at all.
>  We know very well that rewriting operations on floats can slightly
> change their results, so we don't do it.  In other words the JIT
> produces a sequence of residual operations that has bit-wise the same
> effect as the original sequence of Python operations.
>
> (More precisely, it seems that we only replace FLOAT_MUL(x, 1.0) by
> "x" and FLOAT_MUL(x, -1.0) by "-x", as well as simplify repeated
> FLOAT_NEG's and assume that FLOAT_MUL's are commutative.  As far as I
> can tell these trivial optimizations are all bit-wise correct, at
> least on modern FPUs.)
>
>
> A bientôt,
>
> Armin.
> _______________________________________________
> pypy-dev mailing list
> pypy-dev at python.org
> http://mail.python.org/mailman/listinfo/pypy-dev
>

I should note that I wrote all of these operations by verifying that GCC
would do them, as well as testing on obscure values.  Note for example that
we don't constant fold x + 0.0 (changes the sign of x at x== -0.0).

ALex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20111016/be2e54c7/attachment.html>


More information about the pypy-dev mailing list