]> git.ipfire.org Git - thirdparty/glibc.git/blob - math/w_exp2f.c
Use non-signaling floating-point comparisons in math functions.
[thirdparty/glibc.git] / math / w_exp2f.c
1 /*
2 * wrapper exp2f(x)
3 */
4
5 #include <float.h>
6 #include <math.h>
7 #include <math_private.h>
8
9 static const float o_threshold = (float) FLT_MAX_EXP;
10 static const float u_threshold = (float) (FLT_MIN_EXP - FLT_MANT_DIG - 1);
11
12 float
13 __exp2f (float x)
14 {
15 if (__builtin_expect (islessequal (x, u_threshold)
16 || isgreater (x, o_threshold), 0)
17 && _LIB_VERSION != _IEEE_ && __finitef (x))
18 /* exp2 overflow: 144, exp2 underflow: 145 */
19 return __kernel_standard_f (x, x, 144 + (x <= o_threshold));
20
21 return __ieee754_exp2f (x);
22 }
23 weak_alias (__exp2f, exp2f)