C atanh()

The atanh() function takes a single argument (-1 ≤ x ≥ 1), and returns the arc hyperbolic tangent in radians.

The atanh() function is included in <math.h> header file.

atanh() Prototype

double atanh(double x);

To find arc hyperbolic tangent of type int, float or long double, you can explicitly convert the type to double using cast operator.

 int x = 0;
 double result;
 result = atanh(double(x));

Also, two functions atanhf() and atanhl() were introduced in C99 to work specifically with type float and long double respectively.

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

atanh() Parameter

The atanh() function takes a single argument greater than or equal to -1 and less than or equal to 1.

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

Example 1: atanh() function with different parameters

#include <stdio.h>
#include <math.h>

int main()
    // constant PI is defined
    const double PI =  3.1415926;
    double x, result;

    x =  -0.5;
    result = atanh(x);
    printf("atanh(%.2f) = %.2lf in radians\n", x, result);

    // converting radians to degree
    result = atanh(x)*180/PI;
    printf("atanh(%.2f) = %.2lf in degrees\n", x, result);

    // parameter not in range
    x = 3;
    result = atanh(x);
    printf("atanh(%.2f) = %.2lf", x, result);

    return 0;


atanh(-0.50) = -0.55 in radians
atanh(-0.50) = -31.47 in degrees
atanh(3.00) = nan
Did you find this article helpful?