首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Math.acosh

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

?x≥1,Math.acosh(x)=arcosh(x)= the unique y≥0such thatcosh(y)=x\forall x \geq 1, \mathtt{\operatorname{Math.acosh}(x)} = \operatorname{arcosh}(x) = \text{ the unique } \; y \geq 0 \; \text{such that} \; \cosh(y) = x

语法

代码语言:javascript
复制
Math.acosh(x)

参数

x一个数字。

返回值

返回指定参数的反双曲余弦值,如果指定的参数小于 1 则返回NaN

描述

因为acosh()是Math对象的静态方法,所以你应该像这样使用它:Math.acosh(), 而不是作为你创建的Math实例的属性(Math不是构造函数)。

示例

使用Math.acosh()

代码语言:javascript
复制
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

Polyfill

当?x≥1时,都有?arcosh(x)=ln(x+x2-1)?,因此我们可以使用以下函数来模仿Math.acosh():

代码语言:javascript
复制
Math.acosh = Math.acosh || function(x) {
  return Math.log(x + Math.sqrt(x * x - 1));
};

规范

Specification

Status

Comment

ECMAScript 2015 (6th Edition, ECMA-262)The definition of 'Math.acosh' in that specification.

Standard

Initial definition.

ECMAScript Latest Draft (ECMA-262)The definition of 'Math.acosh' in that specification.

Draft

?

浏览器兼容性

Feature

Chrome

Firefox

Edge

Internet Explorer

Opera

Safari

Basic Support

38

25

(Yes)

(No)

25

7.1

Feature

Android

Chrome for Android

Edge mobile

Firefox for Android

IE mobile

Opera Android

iOS Safari

Basic Support

(Yes)

(Yes)

(Yes)

25

(No)

(Yes)

8

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com