docs: function qpois(lambda, lowerTail, logp) {
        var goodParams, mu, sigma, gamma;
  
        logp = logp === true;
        lowerTail = lowerTail !== false;
        goodParams = lambda >= 0 && lambda < Infinity;
  
        if (!goodParams) { return function(prob) { return NaN; }; }
        if (lambda === 0) {
           return function(prob) {
              // this behavior seems wrong but it matches R's implementation --
              // when prob is out of range and lambda === 0, doesn't return NaN
              return utils.hasNaN(prob) ? NaN : 0;
           };
        }
  
        mu = lambda;
        sigma = Math.sqrt(lambda);
        gamma = 1 / sigma;
  
        return pWrap(true, logp, function(ps) {
           var z, ret;
  
           if (ps.p === 0) { return lowerTail ? 0 : Infinity; }
           if (ps.q === 0) { return lowerTail ? Infinity : 0; }
  
           z = qnorm(0, 1, lowerTail)(ps.p); // initial value
           if (z < -10) { z = -10; }
           if (z > 10) { z = 10; }
           ret = Math.floor(mu + sigma * (z + gamma * (z * z - 1) / 6) + 0.5);
           if (lowerTail) {
              return discInvCdf(0, 1e10, ret, ps.p, ppois(lambda));
           }
           return discInvCdf2(0, 1e10, ret, ps.p, ppois(lambda, false));
        });
     }