cosh(), coshf(), coshl() — Calculate hyperbolic cosine
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
ISO C |
both |
Format
#include <math.h>
double cosh(double x);
float cosh(float x); /* C++ only */
long double cosh(long double x); /* C++ only */
float coshf(float x);
long double coshl(long double x);
General description
Calculates the hyperbolic
cosine of x. The value x is
expressed in radians.
Note: These functions work in both IEEE Binary
Floating-Point and hexadecimal floating-point formats. See IEEE binary floating-point for more information about IEEE
Binary Floating-Point.
Returned value
If the result overflows, the function returns +HUGE_VAL and sets errno to ERANGE.
Example
CELEBC27
/* CELEBC27
This example calculates y to be the hyperbolic cosine of x.
*/
#include <math.h>
#include <stdio.h>
int main(void)
{
double x,y;
x = 7.2;
y = cosh(x);
printf("cosh( %lf ) = %lf\n", x, y);
}
Output
cosh( 7.200000 ) = 669.715755
Related information
- math.h
- acos(), acosf(), acosl() — Calculate arccosine
- acosh(), acoshf(), acoshl() — Calculate hyperbolic arccosine
- asin(), asinf(), asinl() — Calculate arcsine
- asinh(), asinhf(), asinhl() — Calculate hyperbolic arcsine
- atan(), atanf(), atanl(), atan2(), atan2f(), atan2l() — Calculate arctangent
- atanh(), atanhf(), atanhl() — Calculate hyperbolic arctangent
- cos(), cosf(), cosl() — Calculate cosine
- sin(), sinf(), sinl() — Calculate sine
- sinh(), sinhf(), sinhl() — Calculate hyperbolic sine
- tan(), tanf(), tanl() — Calculate tangent
- tanh(), tanhf(), tanhl() — Calculate hyperbolic tangent