summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2011-02-10 07:37:50 +0000
committerdas <das@FreeBSD.org>2011-02-10 07:37:50 +0000
commitb0f6e7189c4ef7b5cddb70b4839db87ad4e5d7e8 (patch)
treeb50fb75891d321c907e75f542ddfd5e9fb57748c
parentf2ff0c6d0eea75db8803d1e7ffbdc0b438257407 (diff)
downloadFreeBSD-src-b0f6e7189c4ef7b5cddb70b4839db87ad4e5d7e8.zip
FreeBSD-src-b0f6e7189c4ef7b5cddb70b4839db87ad4e5d7e8.tar.gz
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
-rw-r--r--lib/msun/src/e_asin.c2
-rw-r--r--lib/msun/src/s_atan.c2
-rw-r--r--lib/msun/src/s_cos.c2
-rw-r--r--lib/msun/src/s_sin.c2
-rw-r--r--lib/msun/src/s_tan.c2
5 files changed, 5 insertions, 5 deletions
diff --git a/lib/msun/src/e_asin.c b/lib/msun/src/e_asin.c
index b2cec0e..27de207 100644
--- a/lib/msun/src/e_asin.c
+++ b/lib/msun/src/e_asin.c
@@ -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;
diff --git a/lib/msun/src/s_atan.c b/lib/msun/src/s_atan.c
index 24daed5..566f5dc7 100644
--- a/lib/msun/src/s_atan.c
+++ b/lib/msun/src/s_atan.c
@@ -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;
diff --git a/lib/msun/src/s_cos.c b/lib/msun/src/s_cos.c
index 496027c..29804f4 100644
--- a/lib/msun/src/s_cos.c
+++ b/lib/msun/src/s_cos.c
@@ -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);
}
diff --git a/lib/msun/src/s_sin.c b/lib/msun/src/s_sin.c
index f6ed2b5..17ea846 100644
--- a/lib/msun/src/s_sin.c
+++ b/lib/msun/src/s_sin.c
@@ -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);
}
diff --git a/lib/msun/src/s_tan.c b/lib/msun/src/s_tan.c
index bd62789..196c27e 100644
--- a/lib/msun/src/s_tan.c
+++ b/lib/msun/src/s_tan.c
@@ -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);
}
OpenPOWER on IntegriCloud