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

Math.asinh

Math.asinh()函数返回给定数字的反双曲正弦值, 即:

Math.asinh(x)=arsinh(x)= the unique ysuch thatsinh(y)=x\mathtt{\operatorname{Math.asinh}(x)} = \operatorname{arsinh}(x) = \text{ the unique } \; y \; \text{such that} \; \sinh(y) = x

语法

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

参数

x待计算的数字。

返回值

给定数字的双曲线反正弦。

描述

由于asinh()是Math的静态方法,用户应该直接通过Math.asinh()来使用, 而不是先创建出Math对象再调用该方法(Math不是一个构造器)。

示例

使用Math.asinh()

代码语言:javascript
复制
Math.asinh(1);  // 0.881373587019543
Math.asinh(0);  // 0

Polyfill

由于arsinh(x)=ln(x+x2+1),因此该函数可以被如下的函数所模拟:

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

已正确地处理了一些与浮点计算有关的问题。准确的结果需要特别处理正面/负面,小/大的论点,如在glibcGNU科学图书馆中所做的。

规范

Specification

Status

Comment

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

Standard

Initial definition.

ECMAScript Latest Draft (ECMA-262)The definition of 'Math.asinh' 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