C++ Math cosh
The function calculates the hyperbolic cosine of an angle provided in radians.
Mathematically,
Syntax
Suppose the hyperbolic angle is 'x':
float cosh(float x);
double cosh(double x);
long double cosh(long double x);
double cosh(integral x);
Parameter
x : The angle for which the hyperbolic cosine will be computed.
Return value
It calculates the hyperbolic cosine value of an angle provided in radians.
Example 1
Let's consider a basic scenario where the variable x is of integer type.
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
int x=45;
float radian=x*3.14/180;
std::cout << "Value of degree is :" <<x<<std::endl;
cout<<"cosh(radian): "<<cosh(radian);
return 0;
}
Output:
Value of degree is :45
cosh(radian): 1.32426
In this instance, the cosh function calculates the hyperbolic cosine of a 45-degree angle and provides a result of 1.324.
Example 2
Let's see another simple example.
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
float x=25.5;
float radian=x*3.14/180;
std::cout << "Value of degree is: " << x<<std::endl;
cout<<"cosh(radian): "<<cosh(radian);
return 0;
}
Output:
Value of degree is: 25.5
cosh(radian): 1.10058