diff options
author | das <das@FreeBSD.org> | 2008-08-03 17:39:54 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2008-08-03 17:39:54 +0000 |
commit | e570127fafd3b96a09e858eee7e047700977dc7f (patch) | |
tree | 2443a99cbbfbd02a602689b3db501851c1d9635d /lib/msun/src/e_asinf.c | |
parent | 8883e5c019649d676291980af150ddd497142b96 (diff) | |
download | FreeBSD-src-e570127fafd3b96a09e858eee7e047700977dc7f.zip FreeBSD-src-e570127fafd3b96a09e858eee7e047700977dc7f.tar.gz |
Minor improvements:
- Improve the order of some tests.
- Fix style.
Submitted by: bde
Diffstat (limited to 'lib/msun/src/e_asinf.c')
-rw-r--r-- | lib/msun/src/e_asinf.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/msun/src/e_asinf.c b/lib/msun/src/e_asinf.c index a4c3f00..dc5d9ab 100644 --- a/lib/msun/src/e_asinf.c +++ b/lib/msun/src/e_asinf.c @@ -35,31 +35,30 @@ float __ieee754_asinf(float x) { double s; - float t=0.0,w,p,q,c,r; + float t,w,p,q,c,r; int32_t hx,ix; GET_FLOAT_WORD(hx,x); ix = hx&0x7fffffff; - if(ix==0x3f800000) { - /* asin(1)=+-pi/2 with inexact */ - return x*pio2; - } else if(ix> 0x3f800000) { /* |x|>= 1 */ + if(ix>=0x3f800000) { /* |x| >= 1 */ + if(ix==0x3f800000) /* |x| == 1 */ + return x*pio2; /* asin(+-1) = +-pi/2 with inexact */ return (x-x)/(x-x); /* asin(|x|>1) is NaN */ } else if (ix<0x3f000000) { /* |x|<0.5 */ - if(ix<0x39800000) { /* if |x| < 2**-12 */ + if(ix<0x39800000) { /* |x| < 2**-12 */ if(huge+x>one) return x;/* return x with inexact if x!=0*/ - } else - t = x*x; - p = t*(pS0+t*(pS1+t*pS2)); - q = one+t*qS1; - w = p/q; - return x+x*w; + } + t = x*x; + p = t*(pS0+t*(pS1+t*pS2)); + q = one+t*qS1; + w = p/q; + return x+x*w; } /* 1> |x|>= 0.5 */ w = one-fabsf(x); t = w*(float)0.5; p = t*(pS0+t*(pS1+t*pS2)); q = one+t*qS1; - s = __ieee754_sqrt(t); + s = sqrt(t); w = p/q; t = pio2-2.0*(s+s*w); if(hx>0) return t; else return -t; |