Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

JavaScript | Math.atanh() function

  • Last Updated : 16 Jun, 2020

The Math.atanh() function is an inbuilt function in JavaScript which is used to get hyperbolic arctangent of a number.
The hyperbolic arctangent is known by many names such as hyperbolic inverse tangent and atanh. It is inverse of the hyperbolic tangent function i.e, The inverse hyperbolic tangent of any value says x is the value y for which the hyperbolic tangent of y is x.

if y = atanh(x)
then x = tanh(y)

we have,

 atanh(x) = \frac{1}{2} ln(\frac{1+x}{1-x})

Syntax:

Math.atanh(x)

Parameters:

  • Here x is a number whose hyperbolic arctangent is going to be calculated.

    Return value:

  • It returns the hyperbolic arc-tangent of the given number.

    Browser Support:

  • Here 2nd column contain int values which are the version of the corresponding browser.
    FeatureBasic support
    Chrome38
    EdgeYes
    Firefox25
    Internet ExplorerNo
    Opera25
    Safari8
    Android webviewYes
    Chrome for AndroidYes
    Edge mobileYes
    Firefox for Android25
    Opera AndroidYes
    iOS Safari8

Examples:

Input: Math.atanh(-1)
Output: -Infinity

Explanation:
Here output 0 is the hyperbolic arc-sine of a number 1.

Input: Math.atanh(0)
Output: 0
Input: Math.atanh(0.5)
Output: 0.5493061443340548
Input: Math.atanh(1)
Output: Infinity
Input: Math.atanh(1.2)
Output: NaN
Input: Math.atanh(-2.2)
Output: NaN

For values greater than 1 or less than -1, NaN i.e, not a number is returned.
Let’s see JavaScripts program:




// Here different values is being used for
// getting hyperbolic tangent function's values.
console.log(Math.atanh(-1));
console.log(Math.atanh(0));
console.log(Math.atanh(0.5));
console.log(Math.atanh(1));
console.log(Math.atanh(1.2));
console.log(Math.atanh(-2.2));

Output:

> 0
> 0.5493061443340548
> Infinity
> NaN
> NaN

Application:
Whenever we need to get a get hyperbolic arc-tangent of a number that time we can take help of Math.atanh() function in JavaScript.




// Here different values is being used for getting
// hyperbolic cosine function's values.
console.log(Math.atanh(0.1));
console.log(Math.atanh(22));

Output:

> 0.10033534773107558
> NaN
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!