C++ Math acosh
The function calculates the inverse hyperbolic cosine of an angle provided in radians.
Where, an inverse hyperbolic cosine is the reciprocal function of hyperbolic cosine.
Syntax
Suppose an angle is 'x':
float acosh(float x);
double acosh(double x);
long double acosh(long double x);
double acosh(integral x);
Parameter
x : The value for which the inverse hyperbolic cosine needs to be calculated.
Return value
It returns the arc hyperbolic cosine of x.
Example 1
Let's consider a straightforward example where the degree value is of integer type.
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
int degree =30;
float x = degree*3.14/180;
std::cout << "Value of degree is : " <<degree<< std::endl;
cout<<"cosh(x) : "<<cosh(x)<<'\n';
cout<<"acosh(x) : "<<acosh(x);
return 0;
}
Output:
Value of degree is : 30
cosh(x) : 1.14009
acosh(x) : -nan
In this instance, the acosh method calculates the inverse hyperbolic cosine of x and outputs the result as -nan.
Example 2
Let's consider a basic example where the degree value is of type float.
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
int degree =15.7;
float x = degree*3.14/180;
std::cout << "Value of degree is : " <<degree<< std::endl;
cout<<"cosh(x) : "<<cosh(x)<<'\n';
cout<<"acosh(x) : "<<acosh(x);
return 0;
}
Output:
Value of degree is : 15.7
cosh(x) : 1.03443
acosh(x) : -nan
In this instance, the acosh function calculates the inverse hyperbolic cosine of x and provides the result of -nan.