w_coshf.c 968 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* w_coshf.c -- float version of w_cosh.c.
  2. * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
  3. * Optimizations by Ulrich Drepper <drepper@gmail.com>, 2011.
  4. */
  5. /*
  6. * ====================================================
  7. * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  8. *
  9. * Developed at SunPro, a Sun Microsystems, Inc. business.
  10. * Permission to use, copy, modify, and distribute this
  11. * software is freely granted, provided that this notice
  12. * is preserved.
  13. * ====================================================
  14. */
  15. /*
  16. * wrapper coshf(x)
  17. */
  18. #include <math.h>
  19. #include "math_private.h"
  20. float
  21. coshf (float x)
  22. {
  23. #if defined(__UCLIBC_HAS_FENV__)
  24. float z = (float) __ieee754_cosh ((double) x);
  25. if (__builtin_expect (!isfinite (z), 0) && isfinite (x)
  26. && _LIB_VERSION != _IEEE_)
  27. return __kernel_standard_f (x, x, 105); /* cosh overflow */
  28. return z;
  29. #else
  30. return (float) __ieee754_cosh ((double) x);
  31. #endif
  32. }