[Bug 281001] Improve accuracy of asinf(x)

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 22 Aug 2024 22:23:07 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281001

            Bug ID: 281001
           Summary: Improve accuracy of asinf(x)
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: kargl@FreeBSD.org

Created attachment 253025
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=253025&action=edit
patch to lib/msun/src/e_asinf.c

The attached patch improves the accuracy of asinf(x).  It contains a better
rational
approximation.  For exhaustive testing in the interval, the current libm gives

% ./tlibm asin -fPED -x 0x1p-12f -X 1
Interval tested for asinf: [0.000244141,1]
       ulp <= 0.5:  97.916% 98564994 |  97.916% 98564994
0.5 <  ulp <  0.6:  2.038% 2051023 |  99.953% 100616017
0.6 <  ulp <  0.7:  0.047%   47254 | 100.000% 100663271
0.7 <  ulp <  0.8:  0.000%      25 | 100.000% 100663296
Max ulp: 0.729891 at 5.00732839e-01

which isn't too bad given that much of the computation is actually done in
double
floating point.

With the new rational approximation, exhaustive testing yields

% ./tlibm asin -fPED -x 0x1p-12f -X 1
Interval tested for asinf: [0.000244141,1]
       ulp <= 0.5:  99.711% 100372643 |  99.711% 100372643
0.5 <  ulp <  0.6:  0.288%  290357 | 100.000% 100663000
0.6 <  ulp <  0.7:  0.000%     296 | 100.000% 100663296
Max ulp: 0.636344 at 5.09706438e-01

That is, it's better.

-- 
You are receiving this mail because:
You are the assignee for the bug.