docs: public static double logGamma(double x) {
          double ret;
  
          if (Double.isNaN(x) || (x <= 0.0)) {
              ret = Double.NaN;
          } else if (x < 0.5) {
              return logGamma1p(x) - Math.log(x);
          } else if (x <= 2.5) {
              return logGamma1p((x - 0.5) - 0.5);
          } else if (x <= 8.0) {
              final int n = (int) Math.floor(x - 1.5);
              double prod = 1.0;
              for (int i = 1; i <= n; i++) {
                  prod *= x - i;
              }
              return logGamma1p(x - (n + 1)) + Math.log(prod);
          } else {
              double sum = lanczos(x);
              double tmp = x + LANCZOS_G + .5;
              ret = ((x + .5) * Math.log(tmp)) - tmp +
                      HALF_LOG_2_PI + Math.log(sum / x);
          }
  
          return ret;
      }