C++ cmath cosh() function
Example
Return the hyperbolic cosine of different numbers:
cout << cosh(7);
cout << cosh(56);
cout << cosh(2.45);
Try it Yourself »
Definition and Usage
The cosh()
function returns the hyperbolic cosine of a number.
The hyperbolic cosine is equivalent to (exp(number) + exp(-number)) / 2
.
The cosh()
function is defined in the <cmath>
header file.
Syntax
One of the following:
cosh(double number);
cosh(float number);
Parameter Values
Parameter | Description |
---|---|
number | Required. Specifies a number. If the number is an integer type then it will be treated as a double . |
Technical Details
Returns: | A float value (if the argument is float) or double value (in any other case) representing the hyperbolic cosine of a number. |
---|