JS Built-ins
← Math75 / 215
Mathatanhintermediate

Math.atanh() Out of Domain Returns NaN

πŸ“– Usage Example
// Inverse hyperbolic tangent (input in (-1, 1))
Math.atanh(0)    // β†’ 0
Math.atanh(0.5)  // β†’ 0.5493...

Use Math.atanh() to compute the inverse hyperbolic tangent of a number strictly between -1 and 1.

Math.atanh(x)

Math.atanh() is only defined for |x| < 1. Values outside this range return NaN.

Challenge: Verify that Math.atanh(2) returns NaN.

πŸ’‘ Hints (2)
  • β€’ The open domain of atanh is (-1, 1)
  • β€’ Both Β±1 produce Β±Infinity; values beyond produce NaN