]> git.ipfire.org Git - thirdparty/glibc.git/blame - math/w_exp2f.c
Optimize libm
[thirdparty/glibc.git] / math / w_exp2f.c
CommitLineData
650425ce
UD
1/*
2 * wrapper exp2f(x)
3 */
4
5#include <float.h>
9d13fb24 6#include <math.h>
9277c064 7#include <math_private.h>
650425ce 8
0ac5ae23
UD
9static const float o_threshold = (float) FLT_MAX_EXP;
10static const float u_threshold = (float) (FLT_MIN_EXP - FLT_MANT_DIG - 1);
650425ce
UD
11
12float
0ac5ae23 13__exp2f (float x)
650425ce 14{
0ac5ae23
UD
15 if (__builtin_expect (x <= u_threshold || x > o_threshold, 0)
16 && _LIB_VERSION != _IEEE_ && __finitef (x))
17 /* exp2 overflow: 144, exp2 underflow: 145 */
18 return __kernel_standard_f (x, x, 144 + (x <= o_threshold));
19
650425ce 20 return __ieee754_exp2f (x);
650425ce
UD
21}
22weak_alias (__exp2f, exp2f)