Moved to csu/errno-loc.c.
[platform/upstream/linaro-glibc.git] / math / w_exp2.c
1 /*
2  * wrapper exp2(x)
3  */
4
5 #include <float.h>
6 #include <math.h>
7 #include "math_private.h"
8
9 static const double o_threshold= (double) DBL_MAX_EXP;
10 static const double u_threshold= (double) (DBL_MIN_EXP - DBL_MANT_DIG - 1);
11
12 double
13 __exp2 (double x)               /* wrapper exp2 */
14 {
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))
21     {
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);
28     }
29   return z;
30 #endif
31 }
32 weak_alias (__exp2, exp2)
33 #ifdef NO_LONG_DOUBLE
34 strong_alias (__exp2, __exp2l)
35 weak_alias (__exp2, exp2l)
36 #endif