[PATCH 1/2] ieee754: Remove slow paths from asin and acos
Joseph Myers
joseph@codesourcery.com
Tue Mar 24 23:15:08 GMT 2020
On Mon, 27 Jan 2020, Szabolcs Nagy wrote:
> On 27/01/2020 10:45, Anssi Hannula wrote:
> > asin and acos have slow paths for rounding the last bit that cause some
> > calls to be 500-1500x slower than average calls.
> >
> > These slow paths are rare, a test of a trillion (1.000.000.000.000)
> > random inputs between -1 and 1 showed 32870 slow calls for acos and 4473
> > for asin, with most occurrences between -1.0 .. -0.9 and 0.9 .. 1.0.
> >
> > The slow paths claim correct rounding and use __sin32() and __cos32()
> > (which compare two result candidates and return the closest one) as the
> > final step, with the second result candidate (res1) having a small offset
> > applied from res. This suggests that res and res1 are intended to be 1
> > ULP apart (which makes sense for rounding), barring bugs, allowing us to
> > pick either one and still remain within 1 ULP of the exact result.
> >
> > Remove the slow paths as the accuracy is better than 1 ULP even without
> > them, which is enough for glibc.
> >
> > Also remove code comments claiming correctly rounded results.
>
> the patch looks good to me.
Yes, please commit.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list