shim.js 289 B

123456789101112
  1. "use strict";
  2. var log = Math.log, sqrt = Math.sqrt;
  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 0;
  8. if (value === Infinity) return value;
  9. return log(value + sqrt(value * value - 1));
  10. };