1 /* s_scalbnf.c -- float version of s_scalbn.c.
2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
6 * ====================================================
7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
9 * Developed at SunPro, a Sun Microsystems, Inc. business.
10 * Permission to use, copy, modify, and distribute this
11 * software is freely granted, provided that this notice
13 * ====================================================
23 two25
= 3.355443200e+07, /* 0x4c000000 */
24 twom25
= 2.9802322388e-08, /* 0x33000000 */
29 float scalblnf (float x
, long int n
)
37 k
= (ix
&0x7f800000)>>23; /* extract exponent */
38 if (k
==0) { /* 0 or subnormal x */
39 if ((ix
&0x7fffffff)==0) return x
; /* +-0 */
42 k
= ((ix
&0x7f800000)>>23) - 25;
44 if (k
==0xff) return x
+x
; /* NaN or Inf */
46 if (n
> 50000 || k
> 0xfe)
47 return huge
*copysignf(huge
,x
); /* overflow */
49 return tiny
*copysignf(tiny
,x
); /*underflow*/
50 if (k
> 0) /* normal result */
51 {SET_FLOAT_WORD(x
,(ix
&0x807fffff)|(k
<<23)); return x
;}
53 return tiny
*copysignf(tiny
,x
); /*underflow*/
54 k
+= 25; /* subnormal result */
55 SET_FLOAT_WORD(x
,(ix
&0x807fffff)|(k
<<23));
59 #ifdef _DOUBLE_IS_32BITS
62 double scalbln (double x
, long int n
)
68 return (double) scalblnf((float) x
, n
);
71 #endif /* defined(_DOUBLE_IS_32BITS) */