es.math.atanh.js 388 B

12345678910111213
  1. var $ = require('../internals/export');
  2. var nativeAtanh = Math.atanh;
  3. var log = Math.log;
  4. // `Math.atanh` method
  5. // https://tc39.github.io/ecma262/#sec-math.atanh
  6. // Tor Browser bug: Math.atanh(-0) -> 0
  7. $({ target: 'Math', stat: true, forced: !(nativeAtanh && 1 / nativeAtanh(-0) < 0) }, {
  8. atanh: function atanh(x) {
  9. return (x = +x) == 0 ? x : log((1 + x) / (1 - x)) / 2;
  10. }
  11. });