English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

C Language Basic Tutorial

C Language Flow Control

C Language Functions

C Language Arrays

C Language Pointers

C Language Strings

C Language Structure

C Language File

C Others

C Language Reference Manual

C library function atanh() usage and example

C Standard Library <math.h>

The atanh() function returns the inverse hyperbolic tangent of the radian number (the value of the inverse hyperbolic tangent).

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

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

atanh() prototype

double atanh(double x);

To find the hyperbolic arctangent of types int, float, or long double, you can use the cast operator to explicitly convert the type to double.

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

Additionally, C99Two functions atanhf() and atanhl() are introduced in C, which are specifically used for float and long double types.

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

atanh() parameter

The atanh() function takes a single parameter (-1and less than or equal to1parameter.

ParameterDescription
double valueis required. Greater than or equal to1double value (-1 ≤ x ≥ 1).

Example1atanh() function with different parameters

#include <stdio.h>
#include <math.h>
int main()
{
    //PI constant
    const double PI =  3.1415926;
    double x, result;
    x =  -0.5;
    result = atanh(x);
    printf("atanh(%.2f) = %.2lf radians\n", x, result);
    //Convert radians to degrees
    result = atanh(x);*180/PI;
    printf("atanh(%.2f) = %.2lf degree\n", x, result);
    //Parameter is out of range
    x = 3;
    result = atanh(x);
    printf("atanh(%.2f) = %.2lf", x, result);
    return 0;
}

Output Result

atanh(-0.50) = -0.55 radians
atanh(-0.50) = -31.47 degrees
atanh(3.00) = nan

C Standard Library <math.h>