Fri 20 Aug 2010 12:48:37 AM UTC, original submission:
I have reported in maintainers list
http://octave.1599824.n4.nabble.com/gammaln-0-octave-3-3-51-MinGW-td2309223.html#a2309822
gammaln(0) and gammaln((minus integer)) give slatec error
(developement tip)
octave:5> gammaln(0)
***MESSAGE FROM ROUTINE DGAMMA IN LIBRARY SLATEC.
***FATAL ERROR, PROG ABORTED, TRACEBACK REQUESTED
***END OF MESSAGE
***JOB ABORT DUE TO FATAL ERROR.
- ERROR MESSAGE SUMMARY
LIBRARY SUBROUTINE MESSAGE START NERR LEVEL COUNT
SLATEC DGAMMA X IS 0 4 2 2
error: lgamma: exception encountered in Fortran subroutine dlgams_
Seeing the code, liboctave/lo-specfun.cc, I found
double
xgamma (double x)
{
#if defined (HAVE_TGAMMA)
return tgamma (x);
#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
}
For also xlgamma, is the below to be used
else if ((x <= 0 && D_NINT (x) == x) || xisinf (x))
instead if
else if (xisinf (x))
Am I right?
The attached changeset is my proposal to fix the issue
|