1 /* s_scalbnf.c -- float version of s_scalbn.c.
2  * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
3  */
4 
5 /*
6  * ====================================================
7  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8  *
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
12  * is preserved.
13  * ====================================================
14  */
15 
16 #include "fdlibm.h"
17 
18 static const float
19 two25   =  3.355443200e+07,	/* 0x4c000000 */
20 twom25  =  2.9802322388e-08;	/* 0x33000000 */
21 
22 float
scalblnf(float x,long int n)23 scalblnf (float x, long int n)
24 {
25 	__int32_t ix;
26         uint32_t hx;
27         long int k;
28 
29 	GET_FLOAT_WORD(ix,x);
30 	hx = ix&0x7fffffff;
31         k = hx>>23;		                /* extract exponent */
32         if (k==0) {				/* 0 or subnormal x */
33             if (hx == 0) return x;              /* +-0 */
34 	    x *= two25;
35 	    GET_FLOAT_WORD(ix,x);
36 	    k = ((ix&0x7f800000)>>23) - 25;
37             if (n< -50000)
38                 return __math_uflowf(ix<0); 	/*underflow*/
39 	    }
40         if (k==0xff) return x+x;		/* NaN or Inf */
41         k = k+n;
42         if (n> 50000 || k >  0xfe)
43             return __math_oflowf(ix < 0);       /* overflow  */
44         if (k > 0) 				/* normal result */
45 	    {SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;}
46         if (k <= -25)
47 	    return __math_uflowf(ix < 0);	/*underflow*/
48         k += 25;				/* subnormal result */
49 	SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23));
50         return check_uflowf(x*twom25);
51 }
52 
53 _MATH_ALIAS_f_fj(scalbln)
54