shim.js 337B

123456789101112131415
  1. "use strict";
  2. var log = Math.log;
  3. module.exports = function (value) {
  4. if (isNaN(value)) return NaN;
  5. value = Number(value);
  6. if (value < -1) return NaN;
  7. if (value > 1) return NaN;
  8. if (value === -1) return -Infinity;
  9. if (value === 1) return Infinity;
  10. if (value === 0) return value;
  11. return 0.5 * log((1 + value) / (1 - value));
  12. };