Problem with Poissiondist.invcdf(Doub p)


danielnet
11-24-2008, 12:43 PM
First of all:
NR3 is great! Many thanks to the authors.

However, now I ran into a problem with the following code:


Poissondist pois(3961);// or any other number >3961;
double test=pois.invcdf(0.999);

During runtime the exception "bad n in Poissondist" is thrown by Poissondist::cdf(n). For (integer) mean values equal or smaller than 3961 the code runs without problems and invcdf returns the right value.
I tested the code with Borland c++ and with g++.
I hope someone has a solution.

Daniel

Bill Press
11-28-2008, 01:21 PM
Yes, this is a bug. The actually bug is in Gamma::gammapprox, which needs a change in one line. I've posted the bug report and fix here (http://www.nr.com/forum/showthread.php?t=1661). Let me know if you have any further problem.

Thanks for finding this.

danielnet
12-03-2008, 05:01 AM
Now it works fine.
Thank you.

Daniel