JavaScript Math atanh()

The JavaScript Math.atanh() function returns the hyperbolic arctangent of a number.

atanh() performs the inverse operation of the Math.tanh function.

The syntax of the Math.atanh() function is:

Math.atanh(x)

atanh(), being a static method, is called using the Math class name.


Math.atanh() Parameters

The Math.atanh() function takes in:

  • x - A number

Return value from Math.atanh()

  • Returns the hyperbolic arctangent of the given number.
  • Returns NaN if number > 1 or number < -1.

Example: Using Math.atanh()

// Using Math.atanh()

var num = Math.atanh(0);
console.log(num); // 0

var num = Math.atanh(0.75);
console.log(num); // 0.9729550745276566

var num = Math.atanh(1);
console.log(num); // Infinity

var num = Math.atanh(-1);
console.log(num); // -Infinity

var num = Math.atanh(2);
console.log(num); // NaN

var num = Math.atanh(-2);
console.log(num); // NaN

Output

0
0.9729550745276566
Infinity
-Infinity
NaN
NaN

Recommended readings: