# cosh()

The cosh() function returns the hyperbolic cosine of an argument given in radians.

## Syntax

std::cosh(angle)

The angle is measured in radians and the return type is a double, float, or long double.

If the magnitude of the result is too large to express, the function returns HUGE_VAL (positive or negative) and an overflow range error is thrown.

The mathematical formula used in cosh() looks like this:

$cosh(x) = (e^x + e^-x )/2$

## Example

This example uses cosh() to return the hyperbolic cosine of 0.0 radians:

#include <iostream>#include <cmath>
int main() {  double x = 0.0;  double result;
result = std::cosh(x);
std::cout << "The hyperbolic cosine of " << x << " radians is " << result << "\n";  // Output: The hyperbolic cosine of 0 radians is 1}

## Codebyte Example

This example uses cosh() to return the hyperbolic cosine of 1.0 radians:

Favicon IconCodeOutputLoading...

## Contributors

Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.