JavaScript Math.acosh() Method
-
Syntax of JavaScript
Math.acosh(): -
Example Code: Use the
Math.acosh()Method to Get the Hyperbolic Arc-Cosine of Various Numbers -
Example Code: Use the
Math.acosh()Method With Values Less Than 1
We can use the Math.acosh() method to get the hyperbolic arc-cosine of a number in JavaScript.
The Math.acosh(number) method represents the arcosh(number). The straightforward formula to calculate the inverse hyperbolic cosine of the number is ln(number + (number2-1)(-1/2)).
Syntax of JavaScript Math.acosh():
let number = 2;
Math.acosh(number);
Parameters
number |
The Math.acosh() method calculates the hyperbolic arc-cosine of this number. |
Return
It returns the inverse hyperbolic cosine of the number parameter value.
Example Code: Use the Math.acosh() Method to Get the Hyperbolic Arc-Cosine of Various Numbers
In the example below, we have used different positive numbers to get their inverse hyperbolic cosine value using the Math.acosh() method.
let number1 = 30;
let number2 = 6.5;
console.log(Math.acosh(number1));
console.log(Math.acosh(number2));
Output:
4.0940666686320855
2.5589789770286124
Example Code: Use the Math.acosh() Method With Values Less Than 1
When we take a number value below less than 1, the Math.cosh(number) method always returns the NaN value, which means Not a Number that users can see in the output.
let number1 = 1;
let number2 = 0.5;
console.log(Math.acosh(number1));
console.log(Math.acosh(number2));
Output:
0
NaN
Developers can use the Math.acosh() method with all modern browsers to get the hyperbolic arc-cosine value.
