factorialLn function

double factorialLn (int x)

Computes the logarithmic factorial function x -> ln(x!) of an integer number > 0.

Implementation

double factorialLn(int x) {
  if (x < 0) {
    throw ArgumentError.value(x, 'x', messages.argumentPositive);
  }

  if (x <= 1) {
    return 0.0;
  }

  if (x < _factorialCache.length) {
    return log(_factorialCache[x]);
  }

  return gammaLn(x + 1.0);
}