C++ <cmath> - cosh() Function
The C++ <cmath> cosh() function returns hyperbolic cosine of a value. The hyperbolic cosine of x is defined as:
where e is an Euler's number.
Syntax
double cosh (double x); float cosh (float x); long double cosh (long double x);
double cosh (double x); float cosh (float x); long double cosh (long double x); //additional overloads for integral types double cosh (T x);
Parameters
x |
Specify the value. |
Return Value
Returns the hyperbolic cosine of a value.
Example:
In the example below, cosh() function is used to find out the hyperbolic cosine of a value.
#include <iostream> #include <cmath> using namespace std; int main (){ cout<<cosh(0)<<"\n"; cout<<cosh(2)<<"\n"; cout<<cosh(4)<<"\n"; return 0; }
The output of the above code will be:
1 3.7622 27.3082
❮ C++ <cmath> Library