es.math.asinh.js 501 B

123456789101112131415161718
  1. var $ = require('../internals/export');
  2. // eslint-disable-next-line es/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. var n = +x;
  8. return !isFinite(n) || n == 0 ? n : n < 0 ? -asinh(-n) : log(n + sqrt(n * n + 1));
  9. }
  10. // `Math.asinh` method
  11. // https://tc39.es/ecma262/#sec-math.asinh
  12. // Tor Browser bug: Math.asinh(0) -> -0
  13. $({ target: 'Math', stat: true, forced: !($asinh && 1 / $asinh(0) > 0) }, {
  14. asinh: asinh
  15. });