Date: Thu, 10 Feb 2011 07:37:50 +0000 (UTC) From: David Schultz <das@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r218509 - head/lib/msun/src Message-ID: <201102100737.p1A7bo6j013624@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: das Date: Thu Feb 10 07:37:50 2011 New Revision: 218509 URL: http://svn.freebsd.org/changeset/base/218509 Log: 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 Modified: head/lib/msun/src/e_asin.c head/lib/msun/src/s_atan.c head/lib/msun/src/s_cos.c head/lib/msun/src/s_sin.c head/lib/msun/src/s_tan.c Modified: head/lib/msun/src/e_asin.c ============================================================================== --- head/lib/msun/src/e_asin.c Thu Feb 10 07:37:29 2011 (r218508) +++ head/lib/msun/src/e_asin.c Thu Feb 10 07:37:50 2011 (r218509) @@ -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; Modified: head/lib/msun/src/s_atan.c ============================================================================== --- head/lib/msun/src/s_atan.c Thu Feb 10 07:37:29 2011 (r218508) +++ head/lib/msun/src/s_atan.c Thu Feb 10 07:37:50 2011 (r218509) @@ -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; Modified: head/lib/msun/src/s_cos.c ============================================================================== --- head/lib/msun/src/s_cos.c Thu Feb 10 07:37:29 2011 (r218508) +++ head/lib/msun/src/s_cos.c Thu Feb 10 07:37:50 2011 (r218509) @@ -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); } Modified: head/lib/msun/src/s_sin.c ============================================================================== --- head/lib/msun/src/s_sin.c Thu Feb 10 07:37:29 2011 (r218508) +++ head/lib/msun/src/s_sin.c Thu Feb 10 07:37:50 2011 (r218509) @@ -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); } Modified: head/lib/msun/src/s_tan.c ============================================================================== --- head/lib/msun/src/s_tan.c Thu Feb 10 07:37:29 2011 (r218508) +++ head/lib/msun/src/s_tan.c Thu Feb 10 07:37:50 2011 (r218509) @@ -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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102100737.p1A7bo6j013624>