w_exp2f.c 440 B

12345678910111213141516171819202122
  1. /*
  2. * wrapper exp2f(x)
  3. */
  4. #include <math.h>
  5. #include "math_private.h"
  6. float
  7. exp2f (float x)
  8. {
  9. #if __UCLIBC_HAS_FENV__
  10. float z = (float) pow(2.0, (double) x);
  11. if (__builtin_expect (!isfinite (z) || z == 0, 0)
  12. && isfinite (x) && _LIB_VERSION != _IEEE_)
  13. /* exp2 overflow: 144, exp2 underflow: 145 */
  14. return __kernel_standard_f (x, x, 144 + !!signbit (x));
  15. return z;
  16. #else
  17. return (float) pow(2.0, (double) x);
  18. #endif
  19. }