[Bug 281001] Improve accuracy of asinf(x)

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 23 Aug 2024 18:06:58 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281001

Steve Kargl <kargl@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #253025|0                           |1
        is obsolete|                            |

--- Comment #2 from Steve Kargl <kargl@FreeBSD.org> ---
Created attachment 253043
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=253043&action=edit
new patch with changes for both asinf() and acosf().

The new patch has updated the rational approximation in acosf() to match the
new rational approximation in asinf().  This change provides only a small
improve in accuracy in exhaustive testing over the relevant intervals.

Unpatched acosf() gives

% ./tlibm acos -fPED -x -1 -X -0x1p-12f
Interval tested for acosf: [-1,-0.000244141]
       ulp <= 0.5:  97.008% 97651921 |  97.008% 97651921
0.5 <  ulp <  0.6:   2.441%  2457242 |  99.450% 100109163
0.6 <  ulp <  0.7:   0.472%   475503 |  99.922% 100584666
0.7 <  ulp <  0.8:   0.071%    71309 |  99.993% 100655975
0.8 <  ulp <  0.9:   0.007%     7319 | 100.000% 100663294
0.9 <  ulp <  1.0:   0.000%        2 | 100.000% 100663296
Max ulp: 0.914007 at -5.01484931e-01

% ./tlibm acos -fPED -x 0x1p-12f -X 1
Interval tested for acosf: [0.000244141,1]
       ulp <= 0.5:  97.317% 97962530 |  97.317% 97962530
0.5 <  ulp <  0.6:   2.340%  2355182 |  99.657% 100317712
0.6 <  ulp <  0.7:   0.314%   316134 |  99.971% 100633846
0.7 <  ulp <  0.8:   0.029%    29450 | 100.000% 100663296
Max ulp: 0.796035 at 4.99814630e-01


Patched acosf() gives

% ./tlibm acos -fPED -x -1 -X -0x1p-12f
Interval tested for acosf: [-1,-0.000244141]
       ulp <= 0.5:  97.010% 97653245 |  97.010% 97653245
0.5 <  ulp <  0.6:   2.442%  2458373 |  99.452% 100111618
0.6 <  ulp <  0.7:   0.473%   476012 |  99.925% 100587630
0.7 <  ulp <  0.8:   0.068%    68603 |  99.993% 100656233
0.8 <  ulp <  0.9:   0.007%     7063 | 100.000% 100663296
Max ulp: 0.896189 at -5.04511118e-01

% ./tlibm acos -fPED -x 0x1p-12f -X 1
Interval tested for acosf: [0.000244141,1]
       ulp <= 0.5:  97.650% 98298175 |  97.650% 98298175
0.5 <  ulp <  0.6:   2.028%  2041709 |  99.679% 100339884
0.6 <  ulp <  0.7:   0.292%   293555 |  99.970% 100633439
0.7 <  ulp <  0.8:   0.030%    29857 | 100.000% 100663296
Max ulp: 0.775875 at 4.91849005e-01

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