Use non-signaling floating-point comparisons in math functions.
[glibc.git] / math / w_exp2.c
blob7a3b0afb74d224206f1b1ce6cfeab6cc64dc8168
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)
15 if (__builtin_expect (islessequal (x, u_threshold)
16 || isgreater (x, o_threshold), 0)
17 && _LIB_VERSION != _IEEE_ && __finite (x))
18 /* exp2 overflow: 44, exp2 underflow: 45 */
19 return __kernel_standard (x, x, 44 + (x <= o_threshold));
21 return __ieee754_exp2 (x);
23 weak_alias (__exp2, exp2)
24 #ifdef NO_LONG_DOUBLE
25 strong_alias (__exp2, __exp2l)
26 weak_alias (__exp2, exp2l)
27 #endif