This is a continuation of bug 14135. qpois(-1, 0) and qpois(2, 0) should both return NaN. That is, when p is invalid. Currently they both return 0 values. Thanks!

This would seem to be fixable by moving the line: if(lambda == 0) return 0; to just above mu = lambda; line.

Thank you both. There is one problem with the proposed resolution: What should qpois(p = 1, lambda = 0) give? It currently gives '0' {and that is even tested for in the regression tests}, but would give 'Inf' with the proposed change.. Of course this case, is really a border case. Our usual reasoning is that limits should always work, but in this case, qpois(1, 0) may look "ill defined", as lim{p -> 1} qpois(p, 0) = 0 lim{lambda -> 0} qpois(p=1, lambda) = Inf but I think back compatibility should count more here, and more importantly, for dpois() and ppois() the limit behavior for lambda --> 0 is pretty well defined (also mentioned on the French version of the Wikipedia page), and then, as ppois(0, 0) = 1, for the inverse function qpois(), we really want qpois(p = 1, lambda = 0) |--> 0

Similar reasoning applies to other distributions with a limiting case of a point mass. I think their q<dist>() functions do not deal with this issue consistently... but don't have time now to check [[don't find it too important, too]]. I am dealing with qgeom(*, prob=1) now, and leave other cases (if they exist) for future reports / or (better) comments to this report.