Even a check to see that the function is returning a finite value would be nice. If I remember my probability distributions correctly, a Poisson probability has to be between zero and one, so it shouldn't return a non-finite value. I believe that zero would be the right value to return if the calculation gives a non-sensical number. Failing that, I'd even take something where you test the input values, and if they are bigger than the Gamma or Power functions could handle correctly, you give a printout that said "Why are you trying to calculate a Poisson probability with such large numbers, you fool!" Best wishes. Ken On Mon, 26 Apr 2004, Rene Brun wrote: > Ken, > > I will be happy to add any suggestion you might have to protect the code > against the case you mention. > > Rene Brun > > On > Mon, 26 Apr 2004, Ken Bloom wrote: > > > Dear ROOTers, > > > > I'm using ROOT 3.05/07, and am getting non-numerical results out of > > the TMath::Poisson function, under what I admit are extreme conditions: > > > > root [2] TMath::Poisson(170,70) > > Error: Symbol inf is not defined in current scope FILE: LINE:0 > > (Double_t)inf > > *** Interpreter error recovered *** > > > > Yes, I know that the result should be a very tiny number, but I would prefer > > that I get 0.0 (or its moral equivalent) rather than something I can't do math > > with. Can you recommend a protection against this? Thanks, best wishes. > > > > Ken Bloom > > > > ------------------------------------------------------------------------------ > > Ken Bloom, Karma Adjuster Department of Physics > > 734-763-2329 / 734-936-1817 (fax) University of Michigan > > kenbloom@umich.edu http://www.umich.edu/~kenbloom > > > ------------------------------------------------------------------------------ Ken Bloom, Karma Adjuster Department of Physics 734-763-2329 / 734-936-1817 (fax) University of Michigan kenbloom@umich.edu http://www.umich.edu/~kenbloom
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET