diff options
author | bde <bde@FreeBSD.org> | 1997-03-09 16:29:29 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1997-03-09 16:29:29 +0000 |
commit | 6dc700613a5a26417b3b8a3b958664e44dd507fe (patch) | |
tree | 328c568ab800325731d7e389e35755b4bacbbfd2 /lib/msun/src | |
parent | 154b7d3e6c9eb840b8244cd54446d8bab6e56de1 (diff) | |
download | FreeBSD-src-6dc700613a5a26417b3b8a3b958664e44dd507fe.zip FreeBSD-src-6dc700613a5a26417b3b8a3b958664e44dd507fe.tar.gz |
Use __ieee754_sqrt() instead of sqrt() internally. Similarly for the
float versions. Using sqrt() was inefficient.
Obtained from: NetBSD
Diffstat (limited to 'lib/msun/src')
-rw-r--r-- | lib/msun/src/e_acos.c | 8 | ||||
-rw-r--r-- | lib/msun/src/e_acosf.c | 6 | ||||
-rw-r--r-- | lib/msun/src/e_acosh.c | 6 | ||||
-rw-r--r-- | lib/msun/src/e_acoshf.c | 6 | ||||
-rw-r--r-- | lib/msun/src/e_asin.c | 4 | ||||
-rw-r--r-- | lib/msun/src/e_asinf.c | 4 | ||||
-rw-r--r-- | lib/msun/src/e_hypot.c | 6 | ||||
-rw-r--r-- | lib/msun/src/e_hypotf.c | 6 | ||||
-rw-r--r-- | lib/msun/src/e_pow.c | 4 | ||||
-rw-r--r-- | lib/msun/src/e_powf.c | 4 | ||||
-rw-r--r-- | lib/msun/src/s_asinh.c | 6 | ||||
-rw-r--r-- | lib/msun/src/s_asinhf.c | 6 |
12 files changed, 33 insertions, 33 deletions
diff --git a/lib/msun/src/e_acos.c b/lib/msun/src/e_acos.c index e39dc4c..da965af 100644 --- a/lib/msun/src/e_acos.c +++ b/lib/msun/src/e_acos.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char rcsid[] = "$Id$"; +static char rcsid[] = "$Id: e_acos.c,v 1.5 1997/02/22 15:09:54 peter Exp $"; #endif /* __ieee754_acos(x) @@ -35,7 +35,7 @@ static char rcsid[] = "$Id$"; * if x is NaN, return x itself; * if |x|>1, return NaN with invalid signal. * - * Function needed: sqrt + * Function needed: __ieee754_sqrt */ #include "math.h" @@ -92,13 +92,13 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */ z = (one+x)*0.5; p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); - s = sqrt(z); + s = __ieee754_sqrt(z); r = p/q; w = r*s-pio2_lo; return pi - 2.0*(s+w); } else { /* x > 0.5 */ z = (one-x)*0.5; - s = sqrt(z); + s = __ieee754_sqrt(z); df = s; SET_LOW_WORD(df,0); c = (z-df*df)/(s+df); diff --git a/lib/msun/src/e_acosf.c b/lib/msun/src/e_acosf.c index 04107dd..f3c6a50 100644 --- a/lib/msun/src/e_acosf.c +++ b/lib/msun/src/e_acosf.c @@ -14,7 +14,7 @@ */ #ifndef lint -static char rcsid[] = "$Id$"; +static char rcsid[] = "$Id: e_acosf.c,v 1.4 1997/02/22 15:09:55 peter Exp $"; #endif #include "math.h" @@ -68,14 +68,14 @@ qS4 = 7.7038154006e-02; /* 0x3d9dc62e */ z = (one+x)*(float)0.5; p = z*(pS0+z*(pS1+z*(pS2+z*(pS3+z*(pS4+z*pS5))))); q = one+z*(qS1+z*(qS2+z*(qS3+z*qS4))); - s = sqrtf(z); + s = __ieee754_sqrtf(z); r = p/q; w = r*s-pio2_lo; return pi - (float)2.0*(s+w); } else { /* x > 0.5 */ int32_t idf; z = (one-x)*(float)0.5; - s = sqrtf(z); + s = __ieee754_sqrtf(z); df = s; GET_FLOAT_WORD(idf,df); SET_FLOAT_WORD(df,idf&0xfffff000); diff --git a/lib/msun/src/e_acosh.c b/lib/msun/src/e_acosh.c index adaf75d..a471769 100644 --- a/lib/msun/src/e_acosh.c +++ b/lib/msun/src/e_acosh.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char rcsid[] = "$Id$"; +static char rcsid[] = "$Id: e_acosh.c,v 1.4 1997/02/22 15:09:56 peter Exp $"; #endif /* __ieee754_acosh(x) @@ -61,9 +61,9 @@ ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */ return 0.0; /* acosh(1) = 0 */ } else if (hx > 0x40000000) { /* 2**28 > x > 2 */ t=x*x; - return __ieee754_log(2.0*x-one/(x+sqrt(t-one))); + return __ieee754_log(2.0*x-one/(x+__ieee754_sqrt(t-one))); } else { /* 1<x<2 */ t = x-one; - return log1p(t+sqrt(2.0*t+t*t)); + return log1p(t+__ieee754_sqrt(2.0*t+t*t)); } } diff --git a/lib/msun/src/e_acoshf.c b/lib/msun/src/e_acoshf.c index ba4006b..1d234d2 100644 --- a/lib/msun/src/e_acoshf.c +++ b/lib/msun/src/e_acoshf.c @@ -14,7 +14,7 @@ */ #ifndef lint -static char rcsid[] = "$Id$"; +static char rcsid[] = "$Id: e_acoshf.c,v 1.4 1997/02/22 15:09:56 peter Exp $"; #endif #include "math.h" @@ -49,9 +49,9 @@ ln2 = 6.9314718246e-01; /* 0x3f317218 */ return 0.0; /* acosh(1) = 0 */ } else if (hx > 0x40000000) { /* 2**28 > x > 2 */ t=x*x; - return __ieee754_logf((float)2.0*x-one/(x+sqrtf(t-one))); + return __ieee754_logf((float)2.0*x-one/(x+__ieee754_sqrtf(t-one))); } else { /* 1<x<2 */ t = x-one; - return log1pf(t+sqrtf((float)2.0*t+t*t)); + return log1pf(t+__ieee754_sqrtf((float)2.0*t+t*t)); } } diff --git a/lib/msun/src/e_asin.c b/lib/msun/src/e_asin.c index deceaee..e7814c9 100644 --- a/lib/msun/src/e_asin.c +++ b/lib/msun/src/e_asin.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char rcsid[] = "$Id$"; +static char rcsid[] = "$Id: e_asin.c,v 1.6 1997/02/22 15:09:57 peter Exp $"; #endif /* __ieee754_asin(x) @@ -103,7 +103,7 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */ t = w*0.5; p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); - s = sqrt(t); + s = __ieee754_sqrt(t); if(ix>=0x3FEF3333) { /* if |x| > 0.975 */ w = p/q; t = pio2_hi-(2.0*(s+s*w)-pio2_lo); diff --git a/lib/msun/src/e_asinf.c b/lib/msun/src/e_asinf.c index d613a10..593f2e5 100644 --- a/lib/msun/src/e_asinf.c +++ b/lib/msun/src/e_asinf.c @@ -14,7 +14,7 @@ */ #ifndef lint -static char rcsid[] = "$Id$"; +static char rcsid[] = "$Id: e_asinf.c,v 1.5 1997/02/22 15:09:58 peter Exp $"; #endif #include "math.h" @@ -73,7 +73,7 @@ qS4 = 7.7038154006e-02; /* 0x3d9dc62e */ t = w*(float)0.5; p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); - s = sqrtf(t); + s = __ieee754_sqrtf(t); if(ix>=0x3F79999A) { /* if |x| > 0.975 */ w = p/q; t = pio2_hi-((float)2.0*(s+s*w)-pio2_lo); diff --git a/lib/msun/src/e_hypot.c b/lib/msun/src/e_hypot.c index 45d921f..b2a577f 100644 --- a/lib/msun/src/e_hypot.c +++ b/lib/msun/src/e_hypot.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char rcsid[] = "$Id$"; +static char rcsid[] = "$Id: e_hypot.c,v 1.4 1997/02/22 15:10:12 peter Exp $"; #endif /* __ieee754_hypot(x,y) @@ -107,7 +107,7 @@ static char rcsid[] = "$Id$"; t1 = 0; SET_HIGH_WORD(t1,ha); t2 = a-t1; - w = sqrt(t1*t1-(b*(-b)-t2*(a+t1))); + w = __ieee754_sqrt(t1*t1-(b*(-b)-t2*(a+t1))); } else { a = a+a; y1 = 0; @@ -116,7 +116,7 @@ static char rcsid[] = "$Id$"; t1 = 0; SET_HIGH_WORD(t1,ha+0x00100000); t2 = a - t1; - w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); + w = __ieee754_sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { u_int32_t high; diff --git a/lib/msun/src/e_hypotf.c b/lib/msun/src/e_hypotf.c index e921585..5a40918 100644 --- a/lib/msun/src/e_hypotf.c +++ b/lib/msun/src/e_hypotf.c @@ -14,7 +14,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: e_hypotf.c,v 1.4 1997/02/22 15:10:13 peter Exp $"; +static char rcsid[] = "$Id: e_hypotf.c,v 1.5 1997/03/05 11:54:00 bde Exp $"; #endif #include "math.h" @@ -71,14 +71,14 @@ static char rcsid[] = "$Id: e_hypotf.c,v 1.4 1997/02/22 15:10:13 peter Exp $"; if (w>b) { SET_FLOAT_WORD(t1,ha&0xfffff000); t2 = a-t1; - w = sqrtf(t1*t1-(b*(-b)-t2*(a+t1))); + w = __ieee754_sqrtf(t1*t1-(b*(-b)-t2*(a+t1))); } else { a = a+a; SET_FLOAT_WORD(y1,hb&0xfffff000); y2 = b - y1; SET_FLOAT_WORD(t1,ha+0x00800000); t2 = a - t1; - w = sqrtf(t1*y1-(w*(-w)-(t1*y2+t2*b))); + w = __ieee754_sqrtf(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { SET_FLOAT_WORD(t1,0x3f800000+(k<<23)); diff --git a/lib/msun/src/e_pow.c b/lib/msun/src/e_pow.c index 1ec39b1..1aa2f02 100644 --- a/lib/msun/src/e_pow.c +++ b/lib/msun/src/e_pow.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char rcsid[] = "$Id$"; +static char rcsid[] = "$Id: e_pow.c,v 1.4 1997/02/22 15:10:29 peter Exp $"; #endif /* __ieee754_pow(x,y) return x**y @@ -160,7 +160,7 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ if(hy==0x40000000) return x*x; /* y is 2 */ if(hy==0x3fe00000) { /* y is 0.5 */ if(hx>=0) /* x >= +0 */ - return sqrt(x); + return __ieee754_sqrt(x); } } diff --git a/lib/msun/src/e_powf.c b/lib/msun/src/e_powf.c index 508e8fd..a68bb8b 100644 --- a/lib/msun/src/e_powf.c +++ b/lib/msun/src/e_powf.c @@ -14,7 +14,7 @@ */ #ifndef lint -static char rcsid[] = "$Id$"; +static char rcsid[] = "$Id: e_powf.c,v 1.4 1997/02/22 15:10:30 peter Exp $"; #endif #include "math.h" @@ -111,7 +111,7 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/ if(hy==0x40000000) return x*x; /* y is 2 */ if(hy==0x3f000000) { /* y is 0.5 */ if(hx>=0) /* x >= +0 */ - return sqrtf(x); + return __ieee754_sqrtf(x); } ax = fabsf(x); diff --git a/lib/msun/src/s_asinh.c b/lib/msun/src/s_asinh.c index 21024c4..9276327 100644 --- a/lib/msun/src/s_asinh.c +++ b/lib/msun/src/s_asinh.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char rcsid[] = "$Id$"; +static char rcsid[] = "$Id: s_asinh.c,v 1.4 1997/02/22 15:10:56 peter Exp $"; #endif /* asinh(x) @@ -56,10 +56,10 @@ huge= 1.00000000000000000000e+300; w = __ieee754_log(fabs(x))+ln2; } else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */ t = fabs(x); - w = __ieee754_log(2.0*t+one/(sqrt(x*x+one)+t)); + w = __ieee754_log(2.0*t+one/(__ieee754_sqrt(x*x+one)+t)); } else { /* 2.0 > |x| > 2**-28 */ t = x*x; - w =log1p(fabs(x)+t/(one+sqrt(one+t))); + w =log1p(fabs(x)+t/(one+__ieee754_sqrt(one+t))); } if(hx>0) return w; else return -w; } diff --git a/lib/msun/src/s_asinhf.c b/lib/msun/src/s_asinhf.c index 80bcbaa..b14db85 100644 --- a/lib/msun/src/s_asinhf.c +++ b/lib/msun/src/s_asinhf.c @@ -14,7 +14,7 @@ */ #ifndef lint -static char rcsid[] = "$Id$"; +static char rcsid[] = "$Id: s_asinhf.c,v 1.4 1997/02/22 15:10:57 peter Exp $"; #endif #include "math.h" @@ -48,10 +48,10 @@ huge= 1.0000000000e+30; w = __ieee754_logf(fabsf(x))+ln2; } else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */ t = fabsf(x); - w = __ieee754_logf((float)2.0*t+one/(sqrtf(x*x+one)+t)); + w = __ieee754_logf((float)2.0*t+one/(__ieee754_sqrtf(x*x+one)+t)); } else { /* 2.0 > |x| > 2**-28 */ t = x*x; - w =log1pf(fabsf(x)+t/(one+sqrtf(one+t))); + w =log1pf(fabsf(x)+t/(one+__ieee754_sqrtf(one+t))); } if(hx>0) return w; else return -w; } |