Computes the hyperbolic cosine.
#include <math.h>
float coshf (x)
float x;
long double coshl (x)
long double x;
double cosh (x)
double x;
_Decimal32 coshd32 (x)
_Decimal32 x;
_Decimal64 coshd64 (x)
_Decimal64 x;
_Decimal128 coshd128 (x)
_Decimal128 x;
The coshf, coshl, cosh, coshd32, coshd64, and coshd128 subroutines compute the hyperbolic cosine of the x parameter.
An application wishing to check for error situations should set errno to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these functions. On return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.
Item | Description |
---|---|
x | Specifies the value to be computed. |
Upon successful completion, the coshf, coshl, cosh, coshd32, coshd64, and coshd128 subroutines return the hyperbolic cosine of x.
If the correct value would cause overflow, a range error occurs and the coshf, coshl, cosh, coshd32, coshd64, and coshd128 subroutines return the value of the macro HUGE_VALF, HUGE_VALL, HUGE_VAL, HUGE_VAL_D32, HUGE_VAL_D64, and HUGE_VAL_D128 respectively.
If x is NaN, a NaN is returned.
If x is ±0, the value 1.0 is returned.
If x is ±Inf, +Inf is returned.