[BZ #5760]
[glibc.git] / math / w_exp2f.c
blob9120c88b60e48731e9b8d491fd70dd01ae499980
1 /*
2 * wrapper exp2f(x)
3 */
5 #include <float.h>
6 #include <math.h>
7 #include "math_private.h"
9 static const float o_threshold= (float) FLT_MAX_EXP;
10 static const float u_threshold= (float) (FLT_MIN_EXP - FLT_MANT_DIG - 1);
12 float
13 __exp2f (float x) /* wrapper exp2f */
15 #ifdef _IEEE_LIBM
16 return __ieee754_exp2f (x);
17 #else
18 float z;
19 z = __ieee754_exp2f (x);
20 if (_LIB_VERSION != _IEEE_ && __finitef (x))
22 if (x > o_threshold)
23 /* exp2 overflow */
24 return (float) __kernel_standard ((double) x, (double) x, 144);
25 else if (x <= u_threshold)
26 /* exp2 underflow */
27 return (float) __kernel_standard ((double) x, (double) x, 145);
29 return z;
30 #endif
32 weak_alias (__exp2f, exp2f)