Muokkaa

Jaa


cosh, coshf, coshl

Calculates the hyperbolic cosine.

Syntax

double cosh( double x );
float coshf( float x );
long double coshl( long double x );
#define cosh(X) // Requires C11 or higher

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, unless you're using the <tgmath.h> macro to call this function, cosh always takes and returns a double.

If you use the cosh macro from <tgmath.h>, the type of the argument determines which version of the function is selected. See Type-generic math for details.

By default, this function's global state is scoped to the application. To change this behavior, see Global state in the CRT.

Requirements

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

For more compatibility information, see Compatibility.

Example

See the example in sinh, sinhf, sinhl.

See also

Math and floating-point support
acosh, acoshf, acoshl
asinh, asinhf, asinhl
atanh, atanhf, atanhl
_matherr
sinh, sinhf, sinhl
tanh, tanhf, tanhl