math-log1p.js 284 B

123456789
  1. var log = Math.log;
  2. // `Math.log1p` method implementation
  3. // https://tc39.es/ecma262/#sec-math.log1p
  4. // eslint-disable-next-line es/no-math-log1p -- safe
  5. module.exports = Math.log1p || function log1p(x) {
  6. var n = +x;
  7. return n > -1e-8 && n < 1e-8 ? n - n * n / 2 : log(1 + n);
  8. };