about summary refs log tree commit diff
path: root/sysdeps/libm-ieee754/s_scalbnf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/libm-ieee754/s_scalbnf.c')
-rw-r--r--sysdeps/libm-ieee754/s_scalbnf.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sysdeps/libm-ieee754/s_scalbnf.c b/sysdeps/libm-ieee754/s_scalbnf.c
index 3a83e54c56..4799c825c9 100644
--- a/sysdeps/libm-ieee754/s_scalbnf.c
+++ b/sysdeps/libm-ieee754/s_scalbnf.c
@@ -8,7 +8,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -31,10 +31,10 @@ huge   = 1.0e+30,
 tiny   = 1.0e-30;
 
 #ifdef __STDC__
-	float __scalbnf (float x, int n)
+	float __scalbnf (float x, long int n)
 #else
 	float __scalbnf (x,n)
-	float x; int n;
+	float x; long int n;
 #endif
 {
 	int32_t k,ix;
@@ -44,18 +44,18 @@ tiny   = 1.0e-30;
             if ((ix&0x7fffffff)==0) return x; /* +-0 */
 	    x *= two25;
 	    GET_FLOAT_WORD(ix,x);
-	    k = ((ix&0x7f800000)>>23) - 25; 
-            if (n< -50000) return tiny*x; 	/*underflow*/
+	    k = ((ix&0x7f800000)>>23) - 25;
 	    }
         if (k==0xff) return x+x;		/* NaN or Inf */
-        k = k+n; 
-        if (k >  0xfe) return huge*copysignf(huge,x); /* overflow  */
+        k = k+n;
+        if (n> 50000 || k >  0xfe)
+	  return huge*copysignf(huge,x); /* overflow  */
+	if (n< -50000)
+	  return tiny*copysignf(tiny,x);	/*underflow*/
         if (k > 0) 				/* normal result */
 	    {SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;}
         if (k <= -25)
-            if (n > 50000) 	/* in case integer overflow in n+k */
-		return huge*copysignf(huge,x);	/*overflow*/
-	    else return tiny*copysignf(tiny,x);	/*underflow*/
+	    return tiny*copysignf(tiny,x);	/*underflow*/
         k += 25;				/* subnormal result */
 	SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23));
         return x*twom25;