A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Math/acosh below:

Math.acosh() - JavaScript | MDN

Math.acosh()

Baseline Widely available

Math.acosh() 函数返回一个数的反双曲余弦值,即:

∀ x ≥ 1 , Math.acosh ( x ) = arcosh ( x ) = the unique y ≥ 0 such that cosh ( y ) = x \forall x \geq 1, \mathtt{\operatorname{Math.acosh}(x)} = \operatorname{arcosh}(x) = \text{ 唯一的} ; y \geq 0 ; \text{使得} ; \cosh(y) = x 尝试一下
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
语法 参数 返回值

返回给定数的反双曲余弦值,如果该数小于 1 则返回 NaN。

描述

因为 acosh() 是 Math 的静态方法,所以你应该通过 Math.acosh() 调用,而不是作为你创建的 Math 对象的方法(Math 不是构造函数)。

示例 使用 Math.acosh()
Math.acosh(-1); // NaN
Math.acosh(0); // NaN
Math.acosh(0.5); // NaN
Math.acosh(1); // 0
Math.acosh(2); // 1.3169578969248166

当参数小于 1 时,Math.acosh() 将返回 NaN。

向下兼容

当 x ≥ 1 x \geq 1 时,都有 arcosh ( x ) = ln ( x + x2 - 1 ) \operatorname {arcosh} (x) = \ln \left(x + \sqrt{x^{2} - 1} \right) ,因此可以使用以下函数实现:

Math.acosh =
  Math.acosh ||
  function (x) {
    return Math.log(x + Math.sqrt(x * x - 1));
  };
规范 浏览器兼容性 参见

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4