Re: [PATCH] apply transformation on Darwin platform: pow(10, x) ―> __exp10(x)

Nick Lewycky nlewycky at google.com
Sat Dec 21 13:52:08 PST 2013


On 11 December 2013 17:58, Yi Jiang <yjiang at apple.com> wrote:

> It was reverted due to a LTO bug. I resubmitted it in r197109.
>

Hi Yi! I'm replying here because there was no email sent for the commit of
r197109.

This broke a number of tests, such as python's ujson library when built at
-O2:

    def test_numericIntFrcExp(self):
        input = "1.337E40"
        output = ujson.decode(input)
        self.assertEquals(output, json.loads(input))

Their string-to-float parsing logic does a pow(10.0, expr) internally, and
that's now producing a slightly different result (0x1.3a53c2af670d5p+133
vs. 0x1.3a53c2af6707ep+133 to be exact, or 1.337000000000021e+40 vs.
1.337e+40 in decimal).

On the one hand I'd like you to revert this patch (or disable it on linux)
because it's breaking some tests, but I think it's more important first to
understand what the FP accuracy guarantees are and whether we're allowed to
make this transformation even though it will change the exact bit pattern
produced and -ffast-math is not enabled.

Let me know if you need help producing a testcase for where it doesn't
produce bit-exact output.

Nick


> On Dec 5, 2013, at 2:45 PM, Yi Jiang <yjiang at apple.com> wrote:
>
> > Checked in r196544. Thank you!
> > On Dec 5, 2013, at 2:35 PM, Meador Inge <meadori at codesourcery.com>
> wrote:
> >
> >> On 12/05/2013 03:37 PM, Yi Jiang wrote:
> >>
> >>> Hi,
> >>>
> >>> Thank both of you for the comments. I made some adjustment on the
> patch.
> >>
> >> LGTM.  Please commit.  Thanks!
> >>
> >> --
> >> Meador Inge
> >> CodeSourcery / Mentor Embedded
> >
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131221/b274da17/attachment.html>


More information about the llvm-commits mailing list