
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo C - <b>cosh() calculate hyperbolic cosine</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
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);
}
See Also: acos() cos() matherr()
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson