cosh, coshf, coshl

Calculates the hyperbolic cosine.

Syntax

double cosh( double x );
float coshf( float x );
long double coshl( long double x );
float cosh( float x );  // C++ only
long double cosh( long double x );  // C++ only

Parameters

x
Angle in radians.

Return Value

The hyperbolic cosine of x.

By default, if the result is too large in a cosh, coshf, or coshl call, the function returns HUGE_VAL and sets errno to ERANGE.

Input SEH Exception Matherr Exception
± QNAN, IND none _DOMAIN
x ≥ 7.104760e+002 INEXACT+OVERFLOW OVERFLOW

Remarks

Because C++ allows overloading, you can call overloads of cosh that take and return float or long double values. In a C program, cosh always takes and returns a double.

Requirements

Routine Required header (C) Required header (C++)
coshf, cosl, coshl <math.h> <cmath> or <math.h>

For additional compatibility information, see Compatibility.

Example

See the example in sinh, sinhf, sinhl.

See also

Floating-Point Support
acosh, acoshf, acoshl
asinh, asinhf, asinhl
atanh, atanhf, atanhl
_matherr
sinh, sinhf, sinhl
tanh, tanhf, tanhl