1
0

shim.js 245 B

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