Math.acosh()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Phương thức tĩnh Math.acosh() trả về arccos hyperbolic của một số. Cụ thể:

x1,𝙼𝚊𝚝𝚑.𝚊𝚌𝚘𝚜𝚑(𝚡)=arcosh(x)=the unique y0 such that cosh(y)=x=ln(x+x21)\begin{aligned}\forall x \geq 1,\;\mathtt{\operatorname{Math.acosh}(x)} &= \operatorname{arcosh}(x) = \text{the unique } y \geq 0 \text{ such that } \cosh(y) = x\\&= \ln\left(x + \sqrt{x^2 - 1}\right)\end{aligned}

Try it

console.log(Math.acosh(0.999999999999));
// Expected output: NaN

console.log(Math.acosh(1));
// Expected output: 0

console.log(Math.acosh(2));
// Expected output: 1.3169578969248166

console.log(Math.acosh(2.5));
// Expected output: 1.566799236972411

Cú pháp

js
Math.acosh(x)

Tham số

x

Một số lớn hơn hoặc bằng 1.

Giá trị trả về

Arccos hyperbolic của x. Nếu x nhỏ hơn 1, trả về NaN.

Mô tả

acosh() là một phương thức tĩnh của Math, bạn luôn sử dụng nó dưới dạng Math.acosh(), thay vì là phương thức của một đối tượng Math bạn tạo ra (Math không phải là constructor).

Ví dụ

Sử dụng Math.acosh()

js
Math.acosh(0); // NaN
Math.acosh(1); // 0
Math.acosh(2); // 1.3169578969248166
Math.acosh(Infinity); // Infinity

Đặc tả kỹ thuật

Specification
ECMAScript® 2027 Language Specification
# sec-math.acosh

Tương thích trình duyệt

Xem thêm