* posix/unistd.h (_POSIX_VERSION, _POSIX2_VERSION, _POSIX2_C_BIND,
[glibc.git] / math / w_exp2.c
blob446e5ea91cb29d85b9d8062cd956d8844b3feaf9
1 /*
2 * wrapper exp2(x)
3 */
5 #include <float.h>
6 #include <math.h>
7 #include "math_private.h"
9 static const double o_threshold= (double) DBL_MAX_EXP;
10 static const double u_threshold= (double) (DBL_MIN_EXP - DBL_MANT_DIG - 1);
12 double
13 __exp2 (double x) /* wrapper exp2 */
15 #ifdef _IEEE_LIBM
16 return __ieee754_exp2 (x);
17 #else
18 double z;
19 z = __ieee754_exp2 (x);
20 if (_LIB_VERSION != _IEEE_ && __finite (x))
22 if (x > o_threshold)
23 /* exp2 overflow */
24 return __kernel_standard (x, x, 44);
25 else if (x <= u_threshold)
26 /* exp2 underflow */
27 return __kernel_standard (x, x, 45);
29 return z;
30 #endif
32 weak_alias (__exp2, exp2)
33 #ifdef NO_LONG_DOUBLE
34 strong_alias (__exp2, __exp2l)
35 weak_alias (__exp2, exp2l)
36 #endif