C math - atanh() Function
The C math atanh() function is used to return inverse hyperbolic tangent of a value. The hyperbolic tangent of x is defined as:
Syntax
double atanh(double x); float atanhf(float x); long double atanhl(long double x);
Parameters
x |
Specify the value in range [-1, 1]. |
Return Value
Returns the 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 below example, atanh() function is used to find out the hyperbolic tangent of a value.
#include <stdio.h> #include <math.h> int main (){ printf("%lf\n", atanh(0.1)); printf("%lf\n", atanh(0.5)); printf("%lf\n", atanh(2)); return 0; }
The output of the above code will be:
0.100335 0.549306 -nan
❮ C <math.h> Library