C++ <cmath> - atanh() Function
The C++ <cmath> atanh() function returns inverse hyperbolic tangent of a value. The inverse hyperbolic tangent of x is defined as:
Syntax
double atanh (double x); float atanh (float x); long double atanh (long double x); double atanh (T x);
Parameters
x |
Specify the value in range [-1, 1]. |
Return Value
Returns the inverse hyperbolic tangent of a value.
If the x is not in the range of [-1, 1], domain error occurs.
If the x is -1 or 1, pole error may occur.
Example:
In the example below, atanh() function is used to find out the inverse hyperbolic tangent of a value.
#include <iostream> #include <cmath> using namespace std; int main () { cout<<atanh(0.1)<<"\n"; cout<<atanh(0.5)<<"\n"; cout<<atanh(2)<<"\n"; return 0; }
The output of the above code will be:
0.100335 0.549306 -nan
❮ C++ <cmath> Library