The acosh() is an inbuilt function in C++ STL which returns the inverse hyperbolic cosine of an angle given in radians.
Syntax:
acosh(data_type x)
Parameter :The function accepts one mandatory parameter x which specifies the inverse hyperbolic angle in radian which should be greater or equal to 1. If the argument is less than 1, -nan is returned. The parameter can be of double, float or long double datatype.
Return : The acosh() function returns the inverse hyperbolic sine of the argument in radians which is in the range [0, inf].
Below programs illustrate the above approach:
Program 1:
// C++ program to demonstrate // the acosh() function #include <bits/stdc++.h> using namespace std; int main() { double x = 50.0; // Function call to calculate acosh(x) value double result = acosh(x); cout << "acosh(50.0) = " << result << " radians" << endl; cout << "acosh(50.0) = " << result * 180 / 3.141592 << " degrees" << endl; return 0; } |
acosh(50.0) = 4.60507 radians acosh(50.0) = 263.851 degrees
Program 2:
// C++ program to demonstrate // the acosh() function #include <bits/stdc++.h> using namespace std; int main() { int x = 40.0; // Function call to calculate acosh(x) value double result = acosh(x); cout << "acosh(40.0) = " << result << " radians" << endl; cout << "acosh(40.0) = " << result * 180 / 3.141592 << " degrees" << endl; return 0; } |
acosh(40.0) = 4.38187 radians acosh(40.0) = 251.063 degrees
Errors and Exceptions: The function returns no matching function for call to error when a string or a character is passed as an argument.
Program 3:
// C++ program to demonstrate // the acosh() function #include <bits/stdc++.h> using namespace std; int main() { string x = "gfg"; // Function call to calculate acosh(x) value double result = acosh(x); cout << "acosh(50.0) = " << result << " radians" << endl; cout << "acosh(50.0) = " << result * 180 / 3.141592 << " degrees" << endl; return 0; } |
Output:
prog.cpp:11:25: error: no matching function for call to 'acosh(std::__cxx11::string&)' double result = acosh(x);
Program 4:
// C++ program to demonstrate // the acosh() function // value less than 1 #include <bits/stdc++.h> using namespace std; int main() { double x = -50.0; // Function call to calculate acosh(x) value double result = acosh(x); cout << "acosh(-50.0) = " << result << " radians" << endl; cout << "acosh(-50.0) = " << result * 180 / 3.141592 << " degrees" << endl; return 0; } |
acosh(-50.0) = -nan radians acosh(-50.0) = -nan degrees
Rated as one of the most sought after skills in the industry, own the basics of coding with our C++ STL Course and master the very concepts by intense problem-solving.
Recommended Posts:
- acosh() function for complex number in C++
- atanh() function in C++ STL
- vector rbegin() and rend() function in C++ STL
- unordered_multimap begin() and end() function in C++ STL
- list cbegin() and cend() function in C++ STL
- deque assign() function in C++ STL
- bitset all() function in C++ STL
- atan2() function in C++ STL
- list assign() function in C++ STL
- list push_back() function in C++ STL
- list back() function in C++ STL
- bitset set() function in C++ STL
- bitset reset() function in C++ STL
- mktime() function in C++ STL
- list remove() function in C++ STL
- list front() function in C++ STL
- list erase() function in C++ STL
- list end() function in C++ STL
- list empty() function in C++ STL
- sinh() function in C++ STL
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

