 
 Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
atanh() function in C++ STL
The atanh() function returns the arc hyperbolic tangent or the inverse hyperbolic tangent of an angle given in radians. It is an inbuilt function in C++ STL.
The syntax of the atanh() function is given as follows.
atanh(var)
As can be seen from the syntax, the function atanh() accepts a parameter var of data type float, double or long double. The value of this parameter should be between -1 and 1. It returns the arc hyperbolic tangent of var.
A program that demonstrates atanh() in C++ is given as follows.
Example
#include <iostream>
#include <cmath>
using namespace std;
int main() {
   double d = 0.5, ans;
   ans = atanh(d);
   cout << "atanh("<< d <<") = " << ans << endl;
   return 0;
}
Output
atanh(0.5) = 0.549306
In the above program, first the variable d is initialized. Then arc hyperbolic tangent of d is found using atanh() and stored in ans. Finally the value of ans is displayed. This is demonstrated by the following code snippet.
double d = 0.5, ans;
ans = atanh(d);
cout << "atanh("<< d <<") = " << ans << endl;
The result obtained by using the atanh() function can be converted into degrees and displayed. A program to demonstrate this is as follows.
Example
#include <iostream>
#include <cmath>
using namespace std;
int main() {
   double d = 0.5, ans;
   ans = atanh(d);
   ans = ans*180/3.14159;
   cout << "atanh("<<d <<") = " << ans << endl;
   return 0;
}
Output
atanh(0.5) = 31.473
In the above program, the arc hyperbolic tangent is obtained using atanh(). Then this value is converted into degrees. Finally, the output is displayed. This is demonstrated by the following code snippet.
double d = 0.5, ans;
ans = atanh(d);
ans = ans*180/3.14159;
cout << "atanh("<< d <<") = " << ans << endl;