 # C atanh()

The atanh() function defined in the math.h header file. It helps to return the arc hyperbolic tangent value of the given number in radians. The arc hyperbolic tangent means inverse hyperbolic tangent value.

``````
double atanh(double x); #where x can be in int, float or long double
```
```

Also, two functions atanhf() and atanhl() were used with type float and long double respectively.

``````
float atanhf(float x);
long double atanhl(long double x);
```
```

## atanh() Parameters:

The atanh() function takes a single parameter in the range (-1 ≤ x ≥ 1). Using cast operator we can explicitly convert the type to double to find the arc hyperbolic tangent of type int, float, or long double.

Parameter Description Required / Optional
double value A double value greater than or equal to 1  (-1 ≤ x ≥ 1) Required

## atanh() Return Value

The return value of atanh() function is a number in the interval [-pi/2,+pi/2] radians.

Input Return Value
-1 ≤ x ≥ 1 [-pi/2,+pi/2] in radians
-1 > x  NaN (not a number)

## Examples of atanh()

### Example 1: Working of atanh() function in C?

``````
#include <stdio.h>
#include <math.h>
int main()
{

const double PI =  3.1415926;
double v, output;

v =  -0.5;
output = atanh(v);
printf("The atanh(%.2f) is equal to %.2lf in radians\n", v, output);

output = atanh(v)*180/PI;
printf("The atanh(%.2f) is equal to %.2lf in degrees\n", v, output);

// parameter not in range
v = 3;
output = atanh(v);
printf("The atanh(%.2f) is equal to %.2lf", v, output);

return 0;
}
```
```

Output:

```
The atanh(-0.50) is equal to -0.55 in radians
The atanh(-0.50) is equal to -31.47 in degrees
The atanh(3.00) is equal to nan
```

### Example 2: How atanh()worked in C?

``````
#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;
}
```
```

Output:

```
0.100335
0.549306
-nan
```
VIEW ALL
VIEW ALL
##### OtherTutorials
VIEW ALL 