Math.asinh() - JavaScript 编辑
Math.asinh()
返回一个数值的反双曲正弦值,即:
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
语法
Math.asinh(x)
参数
x
- 一个数值.
返回值
返回指定数值的反双曲正弦值.
描述
由于 asinh()
是 Math 的静态方法
,所以应该像这样使用:Math.asinh()
,而不是作为你创建的 Math
实例的方法(Math 不是一个构造函数
)。
示例
使用 Math.asinh()
Math.asinh(1); // 0.881373587019543
Math.asinh(0); // 0
Polyfill
As a quick and dirty hack the expression may be used directly for a coarse emulation by the following function:
Math.asinh = Math.asinh || function(x) {
if (x === -Infinity) {
return x;
} else {
return Math.log(x + Math.sqrt(x * x + 1));
}
};
Been formally correct it suffers from a number of issues related to floating point computations. Accurate result requires special handling of positive/negative, small/large arguments as it done e.g. in glibc or GNU Scientific Library.
规范
Specification |
---|
ECMAScript (ECMA-262) Math.asinh |
浏览器兼容性
BCD tables only load in the browser
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
相关链接
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论