es.math.asinh.js 523 B

1234567891011121314151617181920
  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. var FORCED = !($asinh && 1 / $asinh(0) > 0);
  11. // `Math.asinh` method
  12. // https://tc39.es/ecma262/#sec-math.asinh
  13. // Tor Browser bug: Math.asinh(0) -> -0
  14. $({ target: 'Math', stat: true, forced: FORCED }, {
  15. asinh: asinh
  16. });