Last change
on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
746 bytes
|
Line | |
---|
1 | var $ = require('../internals/export');
|
---|
2 | var log1p = require('../internals/math-log1p');
|
---|
3 |
|
---|
4 | // eslint-disable-next-line es/no-math-acosh -- required for testing
|
---|
5 | var $acosh = Math.acosh;
|
---|
6 | var log = Math.log;
|
---|
7 | var sqrt = Math.sqrt;
|
---|
8 | var LN2 = Math.LN2;
|
---|
9 |
|
---|
10 | var FORCED = !$acosh
|
---|
11 | // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509
|
---|
12 | || Math.floor($acosh(Number.MAX_VALUE)) != 710
|
---|
13 | // Tor Browser bug: Math.acosh(Infinity) -> NaN
|
---|
14 | || $acosh(Infinity) != Infinity;
|
---|
15 |
|
---|
16 | // `Math.acosh` method
|
---|
17 | // https://tc39.es/ecma262/#sec-math.acosh
|
---|
18 | $({ target: 'Math', stat: true, forced: FORCED }, {
|
---|
19 | acosh: function acosh(x) {
|
---|
20 | return (x = +x) < 1 ? NaN : x > 94906265.62425156
|
---|
21 | ? log(x) + LN2
|
---|
22 | : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1));
|
---|
23 | }
|
---|
24 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.