es.math.asinh.js 494 B

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