C Standard Library
Python Java C++ C C# PHP R SQL DS Algo InterviewQ

C <math.h> - atanh() Function



The C <math.h> atanh() function returns inverse hyperbolic tangent of a value. The inverse hyperbolic tangent of x is defined as:

atanh

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 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 <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

5