]> git.ipfire.org Git - thirdparty/glibc.git/blame - math/w_exp2.c
Optimize libm
[thirdparty/glibc.git] / math / w_exp2.c
CommitLineData
650425ce
UD
1/*
2 * wrapper exp2(x)
3 */
4
5#include <float.h>
9d13fb24 6#include <math.h>
9277c064 7#include <math_private.h>
650425ce 8
0ac5ae23
UD
9static const double o_threshold = (double) DBL_MAX_EXP;
10static const double u_threshold = (double) (DBL_MIN_EXP - DBL_MANT_DIG - 1);
650425ce
UD
11
12double
0ac5ae23 13__exp2 (double x)
650425ce 14{
0ac5ae23
UD
15 if (__builtin_expect (x <= u_threshold || x > o_threshold, 0)
16 && _LIB_VERSION != _IEEE_ && __finite (x))
17 /* exp2 overflow: 44, exp2 underflow: 45 */
18 return __kernel_standard (x, x, 44 + (x <= o_threshold));
19
650425ce 20 return __ieee754_exp2 (x);
650425ce
UD
21}
22weak_alias (__exp2, exp2)
23#ifdef NO_LONG_DOUBLE
becf77cd
RM
24strong_alias (__exp2, __exp2l)
25weak_alias (__exp2, exp2l)
650425ce 26#endif