]> git.ipfire.org Git - thirdparty/glibc.git/blob - math/w_exp2_compat.c
Fix the inaccuracy of j0f/j1f/y0f/y1f [BZ #14469, #14470, #14471, #14472]
[thirdparty/glibc.git] / math / w_exp2_compat.c
1 /*
2 * wrapper exp2(x)
3 */
4
5 #include <math.h>
6 #include <math_private.h>
7 #include <math-svid-compat.h>
8 #include <libm-alias-double.h>
9
10 #if LIBM_SVID_COMPAT && (SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_29) \
11 || defined NO_LONG_DOUBLE \
12 || defined LONG_DOUBLE_COMPAT)
13 double
14 __exp2_compat (double x)
15 {
16 double z = __ieee754_exp2 (x);
17 if (__builtin_expect (!isfinite (z) || z == 0, 0)
18 && isfinite (x) && _LIB_VERSION != _IEEE_)
19 /* exp2 overflow: 44, exp2 underflow: 45 */
20 return __kernel_standard (x, x, 44 + !!signbit (x));
21
22 return z;
23 }
24 # if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_29)
25 compat_symbol (libm, __exp2_compat, exp2, GLIBC_2_1);
26 # endif
27 # ifdef NO_LONG_DOUBLE
28 weak_alias (__exp2_compat, exp2l)
29 # endif
30 # ifdef LONG_DOUBLE_COMPAT
31 /* Work around gas bug "multiple versions for symbol". */
32 weak_alias (__exp2_compat, __exp2_compat_alias)
33
34 LONG_DOUBLE_COMPAT_CHOOSE_libm_exp2l (
35 compat_symbol (libm, __exp2_compat_alias, exp2l, FIRST_VERSION_libm_exp2l), );
36 # endif
37 #endif