const LOG10 = Math.log(10);
const LOG2 = Math.log(2);
var utils = {
  // binomial coefficients
  // src: http://blog.plover.com/math/choose.html
  nCk(n, k) {
    let count = n;
    if (k > count) {
      return 0;
    }
    if (k === 0) {
      return 1;
    }
    let coEff = 1;
    for (let i = 1; i <= k; i += 1) {
      coEff *= count;
      coEff /= i;
      count -= 1;
    }
    return coEff;
  },
  log10(n) {
    if (n === 0) return 0;
    return Math.log(n) / LOG10; // IE doesn't support Math.log10 :(
  },
  log2(n) {
    return Math.log(n) / LOG2;
  },
  factorial(num) {
    let rval = 1;
    for (let i = 2; i <= num; i += 1) rval *= i;
    return rval;
  }
};

export { utils as default };
//# sourceMappingURL=utils.mjs.map
