Math.acosh()
返回一个数字的反双曲余弦值,即:
Math.acosh(x)
x
返回指定参数的反双曲余弦值,如果指定的参数小于 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
。
当 时,都有 ,因此我们可以使用以下函数来模仿Math.acosh():
Math.acosh = Math.acosh || function(x) {
return Math.log(x + Math.sqrt(x * x - 1));
};
版本 | 状态 | 注释 |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) Math.acosh |
Standard | Initial definition. |
ECMAScript Latest Draft (ECMA-262) Math.acosh |
Draft |
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 38 | 25 (25) | 未实现 | 25 | 7.1 |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 未实现 | 未实现 | 25.0 (25) | 未实现 | 未实现 | 8 |