w_exp.c 1021 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * ====================================================
  3. * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  4. *
  5. * Developed at SunPro, a Sun Microsystems, Inc. business.
  6. * Permission to use, copy, modify, and distribute this
  7. * software is freely granted, provided that this notice
  8. * is preserved.
  9. * ====================================================
  10. */
  11. /*
  12. * wrapper exp(x)
  13. */
  14. #include "math.h"
  15. #include "math_private.h"
  16. double exp(double x) /* wrapper exp */
  17. {
  18. #ifdef _IEEE_LIBM
  19. return __ieee754_exp(x);
  20. #else
  21. static const double
  22. o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */
  23. u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */
  24. double z;
  25. z = __ieee754_exp(x);
  26. if(_LIB_VERSION == _IEEE_) return z;
  27. if(isfinite(x)) {
  28. if(x>o_threshold)
  29. return __kernel_standard(x,x,6); /* exp overflow */
  30. else if(x<u_threshold)
  31. return __kernel_standard(x,x,7); /* exp underflow */
  32. }
  33. return z;
  34. #endif
  35. }
  36. libm_hidden_def(exp)