Hi Gilles, 2012/8/23 Gilles Sadowski <gil...@harfang.homelinux.org>: > On Thu, Aug 23, 2012 at 10:05:10AM +0200, Sébastien Brisard wrote: >> Hi Luc, >> >> 2012/8/23 Luc Maisonobe <luc.maison...@free.fr>: >> > Le 23/08/2012 05:16, Sébastien Brisard a écrit : >> >> Hi, >> >> in MATH-849, I have proposed an implementation of Gamma(x) >> >> (previously, class Gamma had only logGamma(x)). Gamma(x) is not >> >> defined for x negative integer. In such instances, I would like to >> >> throw an exception instead of returning Double.NaN. However, creating >> >> a new exception in o.a.c.m.exception seems exagerated, since it's very >> >> unlikely that this exception should be used elsewhere (or maybe). >> >> Should I define a nested exception instead [1]? >> >> >> >> What do you think of the name "UnexpectedNegativeIntegerException"? It >> >> does not really match the pattern of already defined exceptions, but I >> >> can't find a better name. >> > >> > Don't we already have NotPositiveException? >> > >> > Luc >> > >> We do, but Gamma is defined for all negative values, except integer ones... > > I think that in some circumstances, it might be useful to not throw > exceptions... > FastMath's "log" returns NaN for negative input. > then I guess that logGamma(x) should also return NaN if x <= 0? I have to say I do not really like this option. My life would sometimes be much easier if NaNs didn't exist... the good old days of the "floating-point error".
Sébastien --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org