JavaScript Math.asinh() Method
The Math.asinh() method in JavaScript is used to calculate the inverse hyperbolic sine (also known as arcsinh) of a number. Mathematically, it calculates the value "y" such that sinh(y) = x, where x is the input value. The result is returned in radians.
The formula for the inverse hyperbolic sine function is −
asinh(x) = ln(x + √(x^2 + 1))
Here, "x" The input value for which we want to find the inverse hyperbolic sine.
Syntax
Following is the syntax of JavaScript Math.asinh() method −
Math.asinh(x)
Parameters
This method accepts only one parameter. The same is described below −
- x: A numeric value.
Return value
This method returns the hyperbolic arcsine of the given number.
Example 1
In the following example, we are using the JavaScript Math.asinh() method to return the inverse hyperbolic sine of 1 and -1 −
<html> <body> <script> const result1 = Math.asinh(1); const result2 = Math.asinh(-1); document.write(result1, "<br>", result2); </script> </body> </html>
Output
If we execute the above program, it returns 0.8813 and -0.8813.
Example 2
Here, we are calculating the inverse hyperbolic sine of 0 and -0 −
<html> <body> <script> const result1 = Math.asinh(0); const result2 = Math.asinh(-0); document.write(result1, "<br>", result2); </script> </body> </html>
Output
If we execute the program, it returns 0 as result.
Example 3
If we provide Infinity and -Infinity as arguments, it returns Infinity and -Infinity, respectively −
<html> <body> <script> const result1 = Math.asinh(Infinity); const result2 = Math.asinh(-Infinity); document.write(result1, "<br>", result2); </script> </body> </html>
Output
After executing the program, it returns Infinity and -Infinity, respectively.