Open In App

JavaScript Math atanh() Method

Last Updated : 12 Jul, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Share
Report
News Follow

The Javascript Math.atanh() method is used to return the hyperbolic arctangent of a number. The atanh() is a static method of Math, therefore it is always used as Math.atanh(), rather than as a method of a Math object created.

Math.atanh (x) = arctanh(x) = y such that tanh (y) = x

Syntax: 

Math.atanh(value)

Parameters: This method accepts a single parameter as mentioned above and described below: 

  • value: This parameter holds the number whose hyperbolic arc-tangent you want to know.

Returns: It returns the hyperbolic arc-tangent of the given number.

Below are examples of the Math.atanh() Method. 

Example 1: This example shows the hyperbolic arctangent when 1 is passed as a parameter.

JavaScript
console.log("When 1 is passed as a parameter: "
    + Math.atanh(1));

Output
When 1 is passed as a parameter: Infinity

Example 2: This example shows the hyperbolic arctangent when 0 is passed as a parameter.

JavaScript
console.log("When 0 is passed as a parameter: "
    + Math.atanh(0));

Output
When 0 is passed as a parameter: 0

Example 3: This example shows the hyperbolic arctangent when 2 is passed as a parameter.

JavaScript
console.log("When 2 is passed as a parameter: " 
     + Math.atanh(2));

Output
When 2 is passed as a parameter: NaN

Example 4: This example shows the hyperbolic arctangent when 0.5 is passed as a parameter.

JavaScript
console.log("When 0.5 is passed as a parameter: "
    + Math.atanh(0.5));

Output
When 0.5 is passed as a parameter: 0.5493061443340548

We have a complete list of Javascript Math Objects methods, to check those please go through this Javascript Math Object Complete reference article.

Supported Browsers:

  • Google Chrome 38.0
  • Firefox 25.0
  • Opera 25.0
  • Safari 8.0

FAQs – JavaScript Math atanh() Method

What is the Math.atanh() method used for?

The Math.atanh() method is used to calculate the hyperbolic arctangent of a number. It returns the value whose hyperbolic tangent is the given number.

Can Math.atanh() accept values outside the range of -1 to 1?

No, Math.atanh() only accepts values in the range of -1 to 1. If a value outside this range is passed, the method will return NaN.

What happens if Math.atanh(1) is called?

If Math.atanh(1) is called, it will return Infinity because the hyperbolic tangent of Infinity is 1.

Is Math.atanh() supported in all browsers?

The Math.atanh() method is supported in modern browsers, including Google Chrome 38 and above, Firefox 25 and above, Opera 25 and above, and Safari 8 and above.

What is a common use case for the Math.atanh() method?

A common use case for the Math.atanh() method is in scientific and engineering calculations where the inverse of the hyperbolic tangent function is required. This can include computations in fields such as physics, signal processing, and complex analysis.



Next Article

Similar Reads

three90RightbarBannerImg
  翻译: