libm: sync with upstream FreeBSD.
Test: ran tests
Change-Id: I16b5930b0dc652ceac60d8ed1d57c6126c74699c
diff --git a/libm/upstream-freebsd/lib/msun/src/e_j0f.c b/libm/upstream-freebsd/lib/msun/src/e_j0f.c
index e53b218..714caac 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_j0f.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_j0f.c
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/lib/msun/src/e_j0f.c 283032 2015-05-17 16:27:06Z kargl $");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_j0f.c 343023 2019-01-14 15:48:35Z pfg $");
/*
* See e_j0.c for complete comments.
@@ -42,7 +42,7 @@
S03 = 5.1354652442e-07, /* 0x3509daa6 */
S04 = 1.1661400734e-09; /* 0x30a045e8 */
-static const float zero = 0.0;
+static const float zero = 0, qrtr = 0.25;
float
__ieee754_j0f(float x)
@@ -59,7 +59,7 @@
c = cosf(x);
ss = s-c;
cc = s+c;
- if(ix<0x7f000000) { /* make sure x+x not overflow */
+ if(ix<0x7f000000) { /* Make sure x+x does not overflow. */
z = -cosf(x+x);
if ((s*c)<zero) cc = z/ss;
else ss = z/cc;
@@ -85,9 +85,9 @@
r = z*(R02+z*(R03+z*(R04+z*R05)));
s = one+z*(S01+z*(S02+z*(S03+z*S04)));
if(ix < 0x3F800000) { /* |x| < 1.00 */
- return one + z*((float)-0.25+(r/s));
+ return one + z*((r/s)-qrtr);
} else {
- u = (float)0.5*x;
+ u = x/2;
return((one+u)*(one-u)+z*(r/s));
}
}
@@ -328,6 +328,7 @@
static __inline float
qzerof(float x)
{
+ static const float eighth = 0.125;
const float *p,*q;
float s,r,z;
int32_t ix;
@@ -340,5 +341,5 @@
z = one/(x*x);
r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5])))));
- return (-(float).125 + r/s)/x;
+ return (r/s-eighth)/x;
}