What is the acosh() function in C++?
Overview
The acosh() function is used to return the inverse hyperbolic cosine in radians of the argument x passed to it.
Note: The arc hyperbolic cosine is the same as the inverse hyperbolic cosine.
Mathematically, this function is given by:
acosh(x) = x
Syntax
double acosh(double x);
float acosh(float x);
long double acosh(long double x);
Parameters
This function takes x as the only and mandatory parameter value.
The value of this parameter must be equal to or greater than 1. When the value passed is less than 1, a domain error is returned.
Return value
The returned value is the arc hyperbolic cosine of the argument x.
Example
#include <iostream>#include <cmath>using namespace std;int main(){// creating variablesint x = 10;double result;// implementing the acoshresult = acosh(x);cout << "acosh(10) = " << result << " radian" << endl;return 0;}
Explanation
-
Line 8 and 9: We create the variables
xandresult. -
Line 12: We implement the
acosh()function on the value ofxand assign it to the variableresult. -
Line 13: We print the result
variable.