UNPKG

445 BJavaScriptView Raw
1var $ = require('../internals/export');
2
3var nativeAsinh = Math.asinh;
4var log = Math.log;
5var sqrt = Math.sqrt;
6
7function asinh(x) {
8 return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : log(x + sqrt(x * x + 1));
9}
10
11// `Math.asinh` method
12// https://tc39.github.io/ecma262/#sec-math.asinh
13// Tor Browser bug: Math.asinh(0) -> -0
14$({ target: 'Math', stat: true, forced: !(nativeAsinh && 1 / nativeAsinh(0) > 0) }, {
15 asinh: asinh
16});