Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C

atanh — C23 library function

`atanh(double x)` from `<math.h>` returns the real principal inverse hyperbolic tangent. For a finite real result, the argument must be in the open interval `(-1, 1)`.

Version: C23

Syntax

double atanh(double x);

atanh(double x) from <math.h> returns the real principal inverse hyperbolic tangent. For a finite real result, the argument must be in the open interval (-1, 1).

It reverses a tanh relation, for example when recovering a hyperbolic parameter from a bounded ratio. The example actually computes atanh(0.5) and prints 0.549.

In base C23 a pole error may occur at x = ±1 and the returned value is implementation-defined; for |x| > 1 a domain error occurs and the returned value is also implementation-defined. A range error may occur when nonzero x is so close to zero that the result underflows. Annex F for IEC 60559 is what requires signed ±0, signed infinities plus divide-by-zero at ±1, NaN plus invalid outside the domain, and NaN propagation.

Examples

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

int main(void) {
    double value = atanh(0.5);
    printf("%.3f\n", value);
    return 0;
}

Result

0.549

It reverses a `tanh` relation, for example when recovering a hyperbolic parameter from a bounded ratio. The example actually computes `atanh(0.5)` and prints `0.549`.

Sources