w_exp2_compat.c 1003 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * wrapper exp2(x)
  3. */
  4. #include <math.h>
  5. #include <math_private.h>
  6. #include <math-svid-compat.h>
  7. #include <libm-alias-double.h>
  8. #if LIBM_SVID_COMPAT && (SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_29) \
  9. || defined NO_LONG_DOUBLE \
  10. || defined LONG_DOUBLE_COMPAT)
  11. double
  12. __exp2_compat (double x)
  13. {
  14. double z = __ieee754_exp2 (x);
  15. if (__builtin_expect (!isfinite (z) || z == 0, 0)
  16. && isfinite (x) && _LIB_VERSION != _IEEE_)
  17. /* exp2 overflow: 44, exp2 underflow: 45 */
  18. return __kernel_standard (x, x, 44 + !!signbit (x));
  19. return z;
  20. }
  21. # if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_29)
  22. compat_symbol (libm, __exp2_compat, exp2, GLIBC_2_1);
  23. # endif
  24. # ifdef NO_LONG_DOUBLE
  25. weak_alias (__exp2_compat, exp2l)
  26. # endif
  27. # ifdef LONG_DOUBLE_COMPAT
  28. /* Work around gas bug "multiple versions for symbol". */
  29. weak_alias (__exp2_compat, __exp2_compat_alias)
  30. LONG_DOUBLE_COMPAT_CHOOSE_libm_exp2l (
  31. compat_symbol (libm, __exp2_compat_alias, exp2l, FIRST_VERSION_libm_exp2l), );
  32. # endif
  33. #endif