math-expm1.js 466 B

1234567891011121314
  1. // eslint-disable-next-line es/no-math-expm1 -- safe
  2. var $expm1 = Math.expm1;
  3. var exp = Math.exp;
  4. // `Math.expm1` method implementation
  5. // https://tc39.es/ecma262/#sec-math.expm1
  6. module.exports = (!$expm1
  7. // Old FF bug
  8. || $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168
  9. // Tor Browser bug
  10. || $expm1(-2e-17) != -2e-17
  11. ) ? function expm1(x) {
  12. return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : exp(x) - 1;
  13. } : $expm1;