FreeBSD Bugzilla – Attachment 253043 Details for
Bug 281001
Improve accuracy of asinf(x) and acosf(x)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
new patch with changes for both asinf() and acosf().
e_asinf.c.diff (text/plain), 2.75 KB, created by
Steve Kargl
on 2024-08-23 18:06:58 UTC
(
hide
)
Description:
new patch with changes for both asinf() and acosf().
Filename:
MIME Type:
Creator:
Steve Kargl
Created:
2024-08-23 18:06:58 UTC
Size:
2.75 KB
patch
obsolete
>diff --git a/lib/msun/src/e_acosf.c b/lib/msun/src/e_acosf.c >index 42ba126d1baa..9bee3378f1f1 100644 >--- a/lib/msun/src/e_acosf.c >+++ b/lib/msun/src/e_acosf.c >@@ -22,11 +22,17 @@ pi = 3.1415925026e+00, /* 0x40490fda */ > pio2_hi = 1.5707962513e+00; /* 0x3fc90fda */ > static volatile float > pio2_lo = 7.5497894159e-08; /* 0x33a22168 */ >+ >+/* >+ * The coefficients for the rational approximatione were generated over >+ * 0x1p-12f <= x <= 0.5f. The maximum error satisfies log2(e) < -30.084. >+ */ > static const float >-pS0 = 1.6666586697e-01, >-pS1 = -4.2743422091e-02, >-pS2 = -8.6563630030e-03, >-qS1 = -7.0662963390e-01; >+pS0 = 1.66666672e-01f, /* 0x3e2aaaab */ >+pS1 = -1.19510300e-01f, /* 0xbdf4c1d1 */ >+pS2 = 5.47002675e-03f, /* 0x3bb33de9 */ >+qS1 = -1.16706085e+00f, /* 0xbf956240 */ >+qS2 = 2.90115148e-01f; /* 0x3e9489f9 */ > > float > acosf(float x) >@@ -46,13 +52,13 @@ acosf(float x) > if(ix<=0x32800000) return pio2_hi+pio2_lo;/*if|x|<2**-26*/ > z = x*x; > p = z*(pS0+z*(pS1+z*pS2)); >- q = one+z*qS1; >+ q = one+z*(qS1+z*qS2); > r = p/q; > return pio2_hi - (x - (pio2_lo-x*r)); > } else if (hx<0) { /* x < -0.5 */ > z = (one+x)*(float)0.5; > p = z*(pS0+z*(pS1+z*pS2)); >- q = one+z*qS1; >+ q = one+z*(qS1+z*qS2); > s = sqrtf(z); > r = p/q; > w = r*s-pio2_lo; >@@ -66,7 +72,7 @@ acosf(float x) > SET_FLOAT_WORD(df,idf&0xfffff000); > c = (z-df*df)/(s+df); > p = z*(pS0+z*(pS1+z*pS2)); >- q = one+z*qS1; >+ q = one+z*(qS1+z*qS2); > r = p/q; > w = r*s+c; > return (float)2.0*(df+w); >diff --git a/lib/msun/src/e_asinf.c b/lib/msun/src/e_asinf.c >index a2ee1a166f03..8d8c55db6394 100644 >--- a/lib/msun/src/e_asinf.c >+++ b/lib/msun/src/e_asinf.c >@@ -18,12 +18,18 @@ > > static const float > one = 1.0000000000e+00, /* 0x3F800000 */ >-huge = 1.000e+30, >- /* coefficient for R(x^2) */ >-pS0 = 1.6666586697e-01, >-pS1 = -4.2743422091e-02, >-pS2 = -8.6563630030e-03, >-qS1 = -7.0662963390e-01; >+huge = 1.000e+30; >+ >+/* >+ * The coefficients for the rational approximatione were generated over >+ * 0x1p-12f <= x <= 0.5f. The maximum error satisfies log2(e) < -30.084. >+ */ >+static const float >+pS0 = 1.66666672e-01f, /* 0x3e2aaaab */ >+pS1 = -1.19510300e-01f, /* 0xbdf4c1d1 */ >+pS2 = 5.47002675e-03f, /* 0x3bb33de9 */ >+qS1 = -1.16706085e+00f, /* 0xbf956240 */ >+qS2 = 2.90115148e-01f; /* 0x3e9489f9 */ > > static const double > pio2 = 1.570796326794896558e+00; >@@ -46,7 +52,7 @@ asinf(float x) > } > t = x*x; > p = t*(pS0+t*(pS1+t*pS2)); >- q = one+t*qS1; >+ q = one+t*(qS1+t*qS2); > w = p/q; > return x+x*w; > } >@@ -54,7 +60,7 @@ asinf(float x) > w = one-fabsf(x); > t = w*(float)0.5; > p = t*(pS0+t*(pS1+t*pS2)); >- q = one+t*qS1; >+ q = one+t*(qS1+t*qS2); > s = sqrt(t); > w = p/q; > t = pio2-2.0*(s+s*w);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 281001
:
253025
| 253043