msun: reduce diff between src/e_j0.c and src/e_j0f.c

PR:	229501
MFC after:	1 week
This commit is contained in:
Pedro F. Giffuni 2019-01-14 15:48:35 +00:00
parent e1bd727904
commit 76c528d350
2 changed files with 12 additions and 10 deletions

View File

@ -80,7 +80,7 @@ S02 = 1.16926784663337450260e-04, /* 0x3F1EA6D2, 0xDD57DBF4 */
S03 = 5.13546550207318111446e-07, /* 0x3EA13B54, 0xCE84D5A9 */
S04 = 1.16614003333790000205e-09; /* 0x3E1408BC, 0xF4745D8F */
static const double zero = 0.0;
static const double zero = 0, qrtr = 0.25;
double
__ieee754_j0(double x)
@ -97,7 +97,7 @@ __ieee754_j0(double x)
c = cos(x);
ss = s-c;
cc = s+c;
if(ix<0x7fe00000) { /* make sure x+x not overflow */
if(ix<0x7fe00000) { /* Make sure x+x does not overflow. */
z = -cos(x+x);
if ((s*c)<zero) cc = z/ss;
else ss = z/cc;
@ -123,9 +123,9 @@ __ieee754_j0(double x)
r = z*(R02+z*(R03+z*(R04+z*R05)));
s = one+z*(S01+z*(S02+z*(S03+z*S04)));
if(ix < 0x3FF00000) { /* |x| < 1.00 */
return one + z*(-0.25+(r/s));
return one + z*((r/s)-qrtr);
} else {
u = 0.5*x;
u = x/2;
return((one+u)*(one-u)+z*(r/s));
}
}
@ -374,6 +374,7 @@ static const double qS2[6] = {
static __inline double
qzero(double x)
{
static const double eighth = 0.125;
const double *p,*q;
double s,r,z;
int32_t ix;
@ -386,5 +387,5 @@ qzero(double x)
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 (-.125 + r/s)/x;
return (r/s-eighth)/x;
}

View File

@ -42,7 +42,7 @@ S02 = 1.1692678527e-04, /* 0x38f53697 */
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 @@ __ieee754_j0f(float x)
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 @@ __ieee754_j0f(float x)
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 const float qS2[6] = {
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 @@ qzerof(float x)
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;
}