use different const in __expo2
[libm] / src / math / __expo2.c
1 #include "libm.h"
2
3 /* k is such that k*ln2 has minimal error */
4 static const uint32_t k = 2043;
5 static const double kln2 = 0x1.62066151add8bp+10;
6
7 /* exp(x)/2 when x >= log(DBL_MAX) */
8 double __expo2(double x)
9 {
10         double scale;
11
12         /* note that k is odd and scale*scale overflows */
13         INSERT_WORDS(scale, (0x3ff + k/2) << 20, 0);
14         /* exp(x - k ln2) * 2**(k-1) */
15         return exp(x - kln2) * scale * scale;
16 }