C++ Math acosh
The function computes the arc hyperbolic cosine of an angle given in radian.
Where , an arc hyperbolic cosine is the inverse operation of hyperbolic cosine.
Syntax
Suppose an angle is 'x':
Example
float acosh(float x);
double acosh(double x);
long double acosh(long double x);
double acosh(integral x);
Parameter
x : The value whose arc hyperbolic cosine is to be computed.
Return value
It returns the arc hyperbolic cosine of x.
Example 1
Let's see the simple example when the value of degree is integer type.
Example
#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:
Output
Value of degree is : 30
cosh(x) : 1.14009
acosh(x) : -nan
In this example, acosh function computes the arc hyperbolic cosine of x and returns the value -nan.
Example 2
Let's see the simple example when the value of degree is float type.
Example
#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:
Output
Value of degree is : 15.7
cosh(x) : 1.03443
acosh(x) : -nan
In this example, acosh computes the arc hyperbolic cosine of x and returns the value -nan.