cosh() Calculate Hyperbolic Cosine
#include <math.h>
double cosh(x); Hyperbolic cosine
double x; Radians
cosh() return the hyperbolic cosine of 'x' radians.
Returns: Hyperbolic cosine of 'x'. If the result is too large,
matherr() is called with an OVERFLOW error, 'errno'
(defined in <stdlib.h>) is set to ERANGE (defined in
<math.h>), and the value 'HUGE" (defined in <math.h>) is
returned.
Notes: OVERFLOW first occurs with 'x' greater than 7.0E2.
Error handling can be modified by using the matherr()
function.
-------------------------------- Example ---------------------------------
The following statements print the hyperbolic cosine of pi and 240 pi
radians, and check for overflow.
#include <math.h> /* for cosh() and ERANGE */
#include <stdio.h> /* for printf() */
#include <stdlib.h> /* for errno */
main()
{
double hcosine, pi = 3.1415926535;
hcosine = cosh(pi);
printf("hyperbolic cosine of pi = %e\n", hcosine);
errno = 0;
hcosine = cosh(240.0 * pi);
if (errno == ERANGE)
printf("ERANGE error in cosh()\n");
printf("hyperbolic cosine of 240 * pi = %e\n", hcosine);
}
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster