docs: function qbinom(size, prob, lowerTail, logp) {
        var goodParams, mu, sigma, gamma;
  
        logp = logp === true;
        lowerTail = lowerTail !== false;
        goodParams = size >= 0 && size < Infinity && size === Math.floor(size) &&
                     prob >= 0 && prob <= 1;
  
        if (!goodParams) { return function(p) { return NaN; }; }
        if (prob === 0) {
           return pWrap(lowerTail, logp,
              function(ps) { return ps.q === 0 ? size : 0; }
           );
        }
        if (prob === 1) {
           return pWrap(lowerTail, logp,
              function(ps) { return ps.p === 0 ? 0 : size; }
           );
        }
        // 0 < prob < 1
        mu = size * prob;
        sigma = Math.sqrt(mu * (1 - prob));
        gamma = (1 - 2 * prob) / sigma;
  
        return utils.qhelper(lowerTail, logp, 0, size, function(p) {
           var z, ret;
  
           if (!utils.isFinite(size) || !utils.isFinite(prob)) { return NaN; }
           if (size === 0 || prob === 0) { return 0; }
  
           z = qnorm(0, 1, lowerTail, logp)(p); // initial value
           ret = Math.floor(mu + sigma * (z + gamma * (z * z - 1) / 6) + 0.5);
           if (ret > size) { ret = size; }
  
           if (lowerTail) {
              return discInvCdf(0, size, ret, p, pbinom(size, prob, true, logp));
           }
  
           return discInvCdf2(0, size, ret, p, pbinom(size, prob, false, logp));
        });
     }