summary refs log tree commit diff
path: root/sysdeps/ieee754/flt-32/s_expm1f.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/flt-32/s_expm1f.c')
-rw-r--r--sysdeps/ieee754/flt-32/s_expm1f.c52
1 files changed, 20 insertions, 32 deletions
diff --git a/sysdeps/ieee754/flt-32/s_expm1f.c b/sysdeps/ieee754/flt-32/s_expm1f.c
index 3f4536b906..1d707120b0 100644
--- a/sysdeps/ieee754/flt-32/s_expm1f.c
+++ b/sysdeps/ieee754/flt-32/s_expm1f.c
@@ -13,22 +13,14 @@
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_expm1f.c,v 1.5 1995/05/10 20:47:11 jtc Exp $";
-#endif
-
 #include <errno.h>
 #include "math.h"
 #include "math_private.h"
 
-static const volatile float huge = 1.0e+30;
-static const volatile float tiny = 1.0e-30;
+static const float huge = 1.0e+30;
+static const float tiny = 1.0e-30;
 
-#ifdef __STDC__
 static const float
-#else
-static float
-#endif
 one		= 1.0,
 o_threshold	= 8.8721679688e+01,/* 0x42b17180 */
 ln2_hi		= 6.9313812256e-01,/* 0x3f317180 */
@@ -41,12 +33,8 @@ Q3  =  -7.9365076090e-05, /* 0xb8a670cd */
 Q4  =   4.0082177293e-06, /* 0x36867e54 */
 Q5  =  -2.0109921195e-07; /* 0xb457edbb */
 
-#ifdef __STDC__
-	float __expm1f(float x)
-#else
-	float __expm1f(x)
-	float x;
-#endif
+float
+__expm1f(float x)
 {
 	float y,hi,lo,c,t,e,hxs,hfx,r1;
 	int32_t k,xsb;
@@ -60,17 +48,17 @@ Q5  =  -2.0109921195e-07; /* 0xb457edbb */
     /* filter out huge and non-finite argument */
 	if(hx >= 0x4195b844) {			/* if |x|>=27*ln2 */
 	    if(hx >= 0x42b17218) {		/* if |x|>=88.721... */
-                if(hx>0x7f800000)
-		    return x+x; 	 /* NaN */
+		if(hx>0x7f800000)
+		    return x+x;		 /* NaN */
 		if(hx==0x7f800000)
 		    return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */
-	        if(x > o_threshold) {
+		if(x > o_threshold) {
 		  __set_errno (ERANGE);
 		  return huge*huge; /* overflow */
 		}
 	    }
 	    if(xsb!=0) { /* x < -27*ln2, return -1.0 with inexact */
-		if(x+tiny<(float)0.0)	/* raise inexact */
+		math_force_eval(x+tiny);/* raise inexact */
 		return tiny-one;	/* return -1 */
 	    }
 	}
@@ -91,7 +79,7 @@ Q5  =  -2.0109921195e-07; /* 0xb457edbb */
 	    x  = hi - lo;
 	    c  = (hi-x)-lo;
 	}
-	else if(hx < 0x33000000) {  	/* when |x|<2**-25, return x */
+	else if(hx < 0x33000000) {	/* when |x|<2**-25, return x */
 	    t = huge+x;	/* return x with inexact flags when x!=0 */
 	    return x - (t-(huge+x));
 	}
@@ -109,28 +97,28 @@ Q5  =  -2.0109921195e-07; /* 0xb457edbb */
 	    e -= hxs;
 	    if(k== -1) return (float)0.5*(x-e)-(float)0.5;
 	    if(k==1) {
-	       	if(x < (float)-0.25) return -(float)2.0*(e-(x+(float)0.5));
-	       	else 	      return  one+(float)2.0*(x-e);
+		if(x < (float)-0.25) return -(float)2.0*(e-(x+(float)0.5));
+		else	      return  one+(float)2.0*(x-e);
 	    }
 	    if (k <= -2 || k>56) {   /* suffice to return exp(x)-1 */
-	        int32_t i;
-	        y = one-(e-x);
+		int32_t i;
+		y = one-(e-x);
 		GET_FLOAT_WORD(i,y);
 		SET_FLOAT_WORD(y,i+(k<<23));	/* add k to y's exponent */
-	        return y-one;
+		return y-one;
 	    }
 	    t = one;
 	    if(k<23) {
-	        int32_t i;
-	        SET_FLOAT_WORD(t,0x3f800000 - (0x1000000>>k)); /* t=1-2^-k */
-	       	y = t-(e-x);
+		int32_t i;
+		SET_FLOAT_WORD(t,0x3f800000 - (0x1000000>>k)); /* t=1-2^-k */
+		y = t-(e-x);
 		GET_FLOAT_WORD(i,y);
 		SET_FLOAT_WORD(y,i+(k<<23));	/* add k to y's exponent */
 	   } else {
-	        int32_t i;
+		int32_t i;
 		SET_FLOAT_WORD(t,((0x7f-k)<<23));	/* 2^-k */
-	       	y = x-(e+t);
-	       	y += one;
+		y = x-(e+t);
+		y += one;
 		GET_FLOAT_WORD(i,y);
 		SET_FLOAT_WORD(y,i+(k<<23));	/* add k to y's exponent */
 	    }