JavaScript Math.atanh() Function
Last Updated :
02 Jan, 2023
The Javascript Math.atanh() function is an inbuilt function in JavaScript that is used to get the hyperbolic arctangent of a number. The hyperbolic arctangent is known by many names such as hyperbolic inverse tangent and atanh. It is the 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:
- x: 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.
Note: Here 2nd column contains int values which are the version of the corresponding browser.
Feature | Basic support |
---|
Chrome | 38 |
Edge | Yes |
Firefox | 25 |
Internet Explorer | No |
Opera | 25 |
Safari | 8 |
Android webview | Yes |
Chrome for Android | Yes |
Edge Mobile | Yes |
Firefox for Android | 25 |
Opera Android | Yes |
iOS Safari | 8 |
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.
Example: Let's see the JavaScripts program.
JavaScript
<script>
// 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));
</script>
Output:
0
0.5493061443340548
Infinity
NaN
NaN
Example: Whenever we need to get a get hyperbolic arc-tangent of a number that time we can take the help of the Math.atanh() function in JavaScript.
JavaScript
<script>
// Here different values is being used for getting
// hyperbolic cosine function's values.
console.log(Math.atanh(0.1));
console.log(Math.atanh(22));
</script>
Output:
0.10033534773107558
NaN
We have a complete list of Javascript Math Objects methods, to check those please go through this Javascript Math Object Complete reference article.
Similar Reads
Less.js Math atan() Function Less.js is a simple CSS pre-processor that facilitates the creation of manageable, customizable, and reusable style sheets for websites. It is chosen because CSS is a dynamic style sheet language. LESS is flexible, thus it functions with a variety of browsers. Web browsers can only use CSS that has
3 min read
JavaScript Math atanh() Method 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(
3 min read
JavaScript Math atan() Method Javascript Math.atan( ) method is used to return the arctangent of a number in radians. The Math.atan() method returns a numeric value between -pi/2 and pi/2 radians. The atan() is a static method of Math, therefore, it is always used as Math.atan(), rather than as a method of a Math object created.
3 min read
JavaScript Math atan2() Method Javascript Math.atan2() method is used to return the arctangent of the quotient of its arguments. The Math.atan2() method returns a numeric value between -Î and Î representing the angle theta of an (x, y) point and the positive x-axis. This is the counterclockwise angle, measured in radians, between
1 min read
JavaScript Math acos() Method The Javascript Math.acos( ) method is used to return the arccosine of a number in radians. The Math.acos() method returns a numeric value between 0 and pi radians. The Math acos() is a static method of Math, therefore, it is always used as Math.acos(), rather than as a method of a Math object create
2 min read