Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
790 B

  1. /* _Cosh function */
  2. #include "xmath.h"
  3. _STD_BEGIN
  4. _CRTIMP2 double __cdecl _Cosh(double x, double y)
  5. { /* compute y * cosh(x), |y| <= 1 */
  6. switch (_Dtest(&x))
  7. { /* test for special codes */
  8. case _NANCODE:
  9. case _INFCODE:
  10. return (x);
  11. case 0:
  12. return (y);
  13. default: /* finite */
  14. if (y == 0.0)
  15. return (y);
  16. if (x < 0.0)
  17. x = -x;
  18. if (x < _Xbig)
  19. { /* worth adding in exp(-x) */
  20. _Exp(&x, 1.0, -1);
  21. return (y * (x + 0.25 / x));
  22. }
  23. switch (_Exp(&x, y, -1))
  24. { /* report over/underflow */
  25. case 0:
  26. _Feraise(_FE_UNDERFLOW);
  27. break;
  28. case _INFCODE:
  29. _Feraise(_FE_OVERFLOW);
  30. }
  31. return (x);
  32. }
  33. }
  34. _STD_END
  35. /*
  36. * Copyright (c) 1992-2001 by P.J. Plauger. ALL RIGHTS RESERVED.
  37. * Consult your license regarding permissions and restrictions.
  38. V3.10:0009 */