2 /* @(#)z_powf.c 1.0 98/08/13 */
7 float powf (float x
, float y
)
9 float d
, k
, t
, r
= 1.0;
10 int n
, sign
, exponent_is_even_int
= 0;
13 GET_FLOAT_WORD (px
, x
);
19 /* Exponent y is an integer. */
20 if (modff (ldexpf (y
, -1), &t
))
23 exponent_is_even_int
= 0;
28 exponent_is_even_int
= 1;
32 if (x
== 0.0 && y
<= 0.0)
36 else if ((t
= y
* log (fabsf (x
))) >= BIGX
)
44 /* y is not an integer. */
48 else if (exponent_is_even_int
)
65 if ( !k
&& fabsf (d
) <= 32767 )
74 if ((unsigned int) n
% 2)
77 n
= (unsigned int) n
/ 2;
87 if ( px
& 0x80000000 )
92 /* y is not an integer. */
100 if (!exponent_is_even_int
)
104 /* y is an odd integer, and x is negative,
105 so the result is negative. */
106 GET_FLOAT_WORD (px
, x
);
108 SET_FLOAT_WORD (x
, px
);
117 #ifdef _DOUBLE_IS_32BITS
119 double pow (double x
, double y
)
121 return (double) powf ((float) x
, (float) y
);
124 #endif /* defined(_DOUBLE_IS_32BITS) */