1
0

shim.js 277 B

1234567891011121314
  1. 'use strict';
  2. var log = Math.log, LOG2E = Math.LOG2E;
  3. module.exports = function (x) {
  4. if (isNaN(x)) return NaN;
  5. x = Number(x);
  6. if (x < 0) return NaN;
  7. if (x === 0) return -Infinity;
  8. if (x === 1) return 0;
  9. if (x === Infinity) return Infinity;
  10. return log(x) * LOG2E;
  11. };