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

C Language Basic Tutorial

C Language Flow Control

Função C

Array C

Ponteiro C

String C

C Language Structure

C Language File

C Others

C Language Reference Manual

C library function atanh() usage and example

Biblioteca Padrão <math.h> C

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

The atanh() function uses a single parameter (-1≤x≥1),and returns the inverse hyperbolic arctangent 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 type 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 uses a parameter greater than or equal to-1and less than or equal to1parameter.

ParameterDescription
double valuegreater 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 degrees to radians
    result = atanh(x)*180/PI;
    printf("atanh(%.2f) = %.2lf degree\n", x, result);
    //Parâmetro fora do intervalo
    x = 3;
    result = atanh(x);
    printf("atanh(%.2f) = %.2lf", x, result);
    return 0;
}

Resultados de Saída

atanh(-0.50) = -0.55 Radianos
atanh(-0.50) = -31.47 Graus
atanh(3.00) = nan

Biblioteca Padrão <math.h> C