For small arguments, these functions use simple approximations,
e.g. cos(small) = 1, sin(small) = small. This commit tightens the thresholds at which the simple approximations are used. Reviewed by: bde
This commit is contained in:
parent
b775d18789
commit
e044d80d08
@ -82,7 +82,7 @@ __ieee754_asin(double x)
|
||||
return x*pio2_hi+x*pio2_lo;
|
||||
return (x-x)/(x-x); /* asin(|x|>1) is NaN */
|
||||
} else if (ix<0x3fe00000) { /* |x|<0.5 */
|
||||
if(ix<0x3e400000) { /* if |x| < 2**-27 */
|
||||
if(ix<0x3e500000) { /* if |x| < 2**-26 */
|
||||
if(huge+x>one) return x;/* return x with inexact if x!=0*/
|
||||
}
|
||||
t = x*x;
|
||||
|
@ -87,7 +87,7 @@ atan(double x)
|
||||
if(hx>0) return atanhi[3]+*(volatile double *)&atanlo[3];
|
||||
else return -atanhi[3]-*(volatile double *)&atanlo[3];
|
||||
} if (ix < 0x3fdc0000) { /* |x| < 0.4375 */
|
||||
if (ix < 0x3e200000) { /* |x| < 2^-29 */
|
||||
if (ix < 0x3e400000) { /* |x| < 2^-27 */
|
||||
if(huge+x>one) return x; /* raise inexact */
|
||||
}
|
||||
id = -1;
|
||||
|
@ -63,7 +63,7 @@ cos(double x)
|
||||
/* |x| ~< pi/4 */
|
||||
ix &= 0x7fffffff;
|
||||
if(ix <= 0x3fe921fb) {
|
||||
if(ix<0x3e400000) /* if x < 2**-27 */
|
||||
if(ix<0x3e46a09e) /* if x < 2**-27 * sqrt(2) */
|
||||
if(((int)x)==0) return 1.0; /* generate inexact */
|
||||
return __kernel_cos(x,z);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ sin(double x)
|
||||
/* |x| ~< pi/4 */
|
||||
ix &= 0x7fffffff;
|
||||
if(ix <= 0x3fe921fb) {
|
||||
if(ix<0x3e400000) /* |x| < 2**-27 */
|
||||
if(ix<0x3e500000) /* |x| < 2**-26 */
|
||||
{if((int)x==0) return x;} /* generate inexact */
|
||||
return __kernel_sin(x,z,0);
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ tan(double x)
|
||||
/* |x| ~< pi/4 */
|
||||
ix &= 0x7fffffff;
|
||||
if(ix <= 0x3fe921fb) {
|
||||
if(ix<0x3e300000) /* x < 2**-28 */
|
||||
if(ix<0x3e400000) /* x < 2**-27 */
|
||||
if((int)x==0) return x; /* generate inexact */
|
||||
return __kernel_tan(x,z,1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user