JavaScript Tutorial JavaScript References

JavaScript - Math.atanh() Method



The JavaScript Math.atanh() method returns inverse hyperbolic tangent of a value. The inverse hyperbolic tangent of x is defined as:

atanh

Syntax

Math.atanh(x)

Parameters

x Specify the value in range [-1, 1].

Return Value

Returns the inverse hyperbolic tangent of a value.
If the x is not in the range of [-1, 1], it returns NaN.
If the x is -1, it returns -Infinity.
If the x is 1, it returns Infinity.

Example:

In the example below, Math.atanh() method is used to find out the inverse hyperbolic tangent of a value.

var txt;

txt = "Math.atanh(0) = " + Math.atanh(0) + "<br>";
txt = txt + "Math.atanh(0.5) = " + Math.atanh(0.5) + "<br>";
txt = txt + "Math.atanh(1) = " + Math.atanh(1) + "<br>";
txt = txt + "Math.atanh(2) = " + Math.atanh(2) + "<br>";
txt = txt + "Math.atanh(-1) = " + Math.atanh(-1) + "<br>";

The output (value of txt) after running above script will be:

Math.atanh(0) = 0
Math.atanh(0.5) = 0.5493061443340548
Math.atanh(1) = Infinity
Math.atanh(2) = NaN
Math.atanh(-1) = -Infinity

❮ JavaScript - Math Object