cosh()
StevenSwiniarski475 total contributions
Published Jul 20, 2021Updated Apr 28, 2023
Contribute to Docs
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:
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:
All contributors
- StevenSwiniarski475 total contributions
- Anonymous contributorAnonymous contributor1 total contribution
- Christine_Yang271 total contributions
- garanews222 total contributions
- Anonymous contributorAnonymous contributor1 total contribution
- christian.dinh2481 total contributions
- Anonymous contributorAnonymous contributor3077 total contributions
- StevenSwiniarski
- Anonymous contributor
- Christine_Yang
- garanews
- Anonymous contributor
- christian.dinh
- Anonymous contributor
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.