cosh, coshl
raw OCR
Calculates the hyperbolic cosine of a value.
Defined in header <math.h>
Syntax
Real versions: Complex version:
#include <math.h> #include <complex.h>
double cosh(double x); complex CGsh(complex x);
long double coshldong double x);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only | |
|---|---|---|---|---|---|
| coshI | ■ | ■ | |||
| Real cosh | ■ | ■ | ■ | ■ | |
| Complex cosh | ■ | ■ | ■ |
Remarks
cost! computes the hyperbolic cosine, (e^ + e'^)/2.
cosh! is the long double version; it takes a long double argument and returns a long double result.
The complex hyperbolic cosine is defined by
cosJi(z) = (exp(z) + exp(-z))/2
Return value
cosh returns the hyperbolic cosine of the argument.
When the correct value would create an overflow, these functions return
| the value HUGE_VAL | (cosh or _LHUGE_VAL | (cosh!) with the |
appropriate sign, and the global variable errno is set to ERANGE.
Error handling for these functions can be modified through the functions matherr and _matherrl.
See also
Example
#include <stdio.h>
#include <math.h>
int main(void)
{
double result, x = 0.5;
result = cosh(x);
printfC'The hyperbole cosine of llf is %lf\n", x, result);
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Extraction notes
- heading `cosh, coshi` read as `cosh, coshl`
Stable link: /3.1/math.h/cosh/
· short form /3.1/cosh/