[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: patch for gamma test
From: |
Tatsuro MATSUOKA |
Subject: |
Re: patch for gamma test |
Date: |
Thu, 18 Nov 2010 08:14:18 +0900 (JST) |
Hello
--- Marco Atzeri wrote:
> > double
> > xgamma (double x)
> > {
> > #if defined (HAVE_TGAMMA)
> > return tgamma (x);
>
> on cywin HAVE_TGAMMA=1
>
>
> > #else
> > double result;
> >
> > if (xisnan (x))
> > result = x;
> > else if ((x <= 0 && D_NINT (x) == x) ||
> > xisinf (x))
> > result = octave_Inf;
> > else
> > F77_XFCN (xdgamma, XDGAMMA, (x, result));
> >
> > return result;
> > #endif
> > }
>
> If the slatec function is correct than only some
> external tgamma are wrong.
> In any case it is better to report a failure on that platform
> and eventually report the failure upstream than
> as today where the fail is wrongly reported on the
> correct platform.
>
> I doubt it is worth to check gamma(-1) during configuration.
My writing perhaps is not enough.
The original slatec gamma function causes an error message and return nothing
when x=0 and x=(minus
integer).
Octave itself implements that tgamma(0) and tgamma(mines interger) take
Infinite using
else if ((x <= 0 && D_NINT (x) == x) || xisinf (x))
when it uses the slatec routine.
To be honest, I do not understand which is mathematically correct,
gamma(-1)=NAN or gamma(-1)=inf.
(Excuse me, the above sentence is not correct English. )
http://en.wikipedia.org/wiki/Gamma_function
Γ(z) to a meromorphic function defined for all complex numbers z, except z = −n
for integers n
≥ 0, where the function has simple poles with residue (
−1)n/n!.
I think that octave can implement gamma(minus implement) in the way gamma
function to be platform
independent.
Regards
Tatsuro
--------------------------------------
Get the new Internet Explorer 8 optimized for Yahoo! JAPAN
http://pr.mail.yahoo.co.jp/ie8/