1 | var $ = require('../internals/export');
|
2 | var log1p = require('../internals/math-log1p');
|
3 |
|
4 | var nativeAcosh = Math.acosh;
|
5 | var log = Math.log;
|
6 | var sqrt = Math.sqrt;
|
7 | var LN2 = Math.LN2;
|
8 |
|
9 | var FORCED = !nativeAcosh
|
10 |
|
11 | || Math.floor(nativeAcosh(Number.MAX_VALUE)) != 710
|
12 |
|
13 | || nativeAcosh(Infinity) != Infinity;
|
14 |
|
15 |
|
16 |
|
17 | $({ target: 'Math', stat: true, forced: FORCED }, {
|
18 | acosh: function acosh(x) {
|
19 | return (x = +x) < 1 ? NaN : x > 94906265.62425156
|
20 | ? log(x) + LN2
|
21 | : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1));
|
22 | }
|
23 | });
|