summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2008-08-03 17:39:54 +0000
committerdas <das@FreeBSD.org>2008-08-03 17:39:54 +0000
commite570127fafd3b96a09e858eee7e047700977dc7f (patch)
tree2443a99cbbfbd02a602689b3db501851c1d9635d
parent8883e5c019649d676291980af150ddd497142b96 (diff)
downloadFreeBSD-src-e570127fafd3b96a09e858eee7e047700977dc7f.zip
FreeBSD-src-e570127fafd3b96a09e858eee7e047700977dc7f.tar.gz
Minor improvements:
- Improve the order of some tests. - Fix style. Submitted by: bde
-rw-r--r--lib/msun/src/e_acosf.c13
-rw-r--r--lib/msun/src/e_asinf.c25
-rw-r--r--lib/msun/src/e_atan2f.c2
3 files changed, 20 insertions, 20 deletions
diff --git a/lib/msun/src/e_acosf.c b/lib/msun/src/e_acosf.c
index ac0d8dd..c9f62cc 100644
--- a/lib/msun/src/e_acosf.c
+++ b/lib/msun/src/e_acosf.c
@@ -38,10 +38,11 @@ __ieee754_acosf(float x)
int32_t hx,ix;
GET_FLOAT_WORD(hx,x);
ix = hx&0x7fffffff;
- if(ix==0x3f800000) { /* |x|==1 */
- if(hx>0) return 0.0; /* acos(1) = 0 */
- else return pi+(float)2.0*pio2_lo; /* acos(-1)= pi */
- } else if(ix>0x3f800000) { /* |x| >= 1 */
+ if(ix>=0x3f800000) { /* |x| >= 1 */
+ if(ix==0x3f800000) { /* |x| == 1 */
+ if(hx>0) return 0.0; /* acos(1) = 0 */
+ else return pi+(float)2.0*pio2_lo; /* acos(-1)= pi */
+ }
return (x-x)/(x-x); /* acos(|x|>1) is NaN */
}
if(ix<0x3f000000) { /* |x| < 0.5 */
@@ -55,14 +56,14 @@ __ieee754_acosf(float x)
z = (one+x)*(float)0.5;
p = z*(pS0+z*(pS1+z*pS2));
q = one+z*qS1;
- s = __ieee754_sqrtf(z);
+ s = 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 = __ieee754_sqrtf(z);
+ s = sqrtf(z);
df = s;
GET_FLOAT_WORD(idf,df);
SET_FLOAT_WORD(df,idf&0xfffff000);
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;
diff --git a/lib/msun/src/e_atan2f.c b/lib/msun/src/e_atan2f.c
index 3b6818a..fc77bff 100644
--- a/lib/msun/src/e_atan2f.c
+++ b/lib/msun/src/e_atan2f.c
@@ -84,7 +84,7 @@ __ieee754_atan2f(float y, float x)
z=pi_o_2+(float)0.5*pi_lo;
m&=1;
}
- else if(hx<0&&k<-26) z=0.0; /* 0 > |y|/x > -2**-26 */
+ else if(k<-26&&hx<0) z=0.0; /* 0 > |y|/x > -2**-26 */
else z=atanf(fabsf(y/x)); /* safe to do y/x */
switch (m) {
case 0: return z ; /* atan(+,+) */
OpenPOWER on IntegriCloud