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