code: function loggamma(x) {
          var v = 1.0,
              w = 1.0 / (x * x),
              ret;
          while (x < N) {
              v = v * x;
              x = x + 1;
          }
          ret = B16 / (16 * 15);
          ret = ret * w + B14 / (14 * 13);
          ret = ret * w + B12 / (12 * 11);
          ret = ret * w + B10 / (10 *  9);
          ret = ret * w + B8  / (8 *  7);
          ret = ret * w + B6  / (6 *  5);
          ret = ret * w + B4  / (4 *  3);
          ret = ret * w + B2  / (2 *  1);
          ret = ret / x + 0.5 * LOG_2PI - Math.log(v) - x + (x - 0.5) * Math.log(x);
          return ret;
      }
docs: /////////// Gamma function