UNPKG

481 BJavaScriptView Raw
1'use strict';
2var $ = require('../internals/export');
3
4// eslint-disable-next-line es/no-math-atanh -- required for testing
5var $atanh = Math.atanh;
6var log = Math.log;
7
8var FORCED = !($atanh && 1 / $atanh(-0) < 0);
9
10// `Math.atanh` method
11// https://tc39.es/ecma262/#sec-math.atanh
12// Tor Browser bug: Math.atanh(-0) -> 0
13$({ target: 'Math', stat: true, forced: FORCED }, {
14 atanh: function atanh(x) {
15 var n = +x;
16 return n === 0 ? n : log((1 + n) / (1 - n)) / 2;
17 }
18});