es.math.atanh.js 437 B

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