Leaked source code of windows server 2003
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.

42 lines
843 B

  1. /* _LCosh function */
  2. #include "wctype.h"
  3. #include "xmath.h"
  4. _STD_BEGIN
  5. _CRTIMP2 long double __cdecl _LCosh(long double x, long double y)
  6. { /* compute y * cosh(x), |y| <= 1 */
  7. switch (_LDtest(&x))
  8. { /* test for special codes */
  9. case NAN:
  10. errno = EDOM;
  11. return (x);
  12. case INF:
  13. if (y == 0)
  14. return (0);
  15. errno = ERANGE;
  16. return (_LInf._L);
  17. case 0:
  18. return (y);
  19. default: /* finite */
  20. if (x < 0)
  21. x = -x;
  22. if (x < _LXbig)
  23. { /* worth adding in exp(-x) */
  24. _LExp(&x, 1, -1);
  25. return (y * (x + 0.25 / x));
  26. }
  27. if (0 <= _LExp(&x, y, -1))
  28. errno = ERANGE; /* x large */
  29. return (x);
  30. }
  31. }
  32. _STD_END
  33. /*
  34. * Copyright (c) 1994 by P.J. Plauger. ALL RIGHTS RESERVED.
  35. * Consult your license regarding permissions and restrictions.
  36. */
  37. /*
  38. 941029 pjp: added _STD machinery
  39. */