JavaScript Math.acosh() Method

Shubham Vora Jan 30, 2023
  1. Syntax of JavaScript Math.acosh():
  2. Example Code: Use the Math.acosh() Method to Get the Hyperbolic Arc-Cosine of Various Numbers
  3. Example Code: Use the Math.acosh() Method With Values Less Than 1
JavaScript Math.acosh() Method

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.

Author: Shubham Vora
Shubham Vora avatar Shubham Vora avatar

Shubham is a software developer interested in learning and writing about various technologies. He loves to help people by sharing vast knowledge about modern technologies via different platforms such as the DelftStack.com website.

LinkedIn GitHub

Related Article - JavaScript Math