2 DOUBLE PRECISION FUNCTION dlngam (X)
28 DOUBLE PRECISION X, DXREL, PI, SINPIY, SQPI2L, SQ2PIL, XMAX,
29 1 y, dgamma, d9lgmc, d1mach, temp
32 SAVE sq2pil, sqpi2l, pi, xmax, dxrel, first
33 DATA sq2pil / 0.9189385332 0467274178 0329736405 62 d0 /
34 DATA sqpi2l / +.2257913526 4472743236 3097614947 441 d+0 /
35 DATA pi / 3.1415926535 8979323846 2643383279 50 d0 /
39 temp = 1.d0/
log(d1mach(2))
41 dxrel =
sqrt(d1mach(4))
46 IF (y.GT.10.d0) go to 20
50 dlngam =
log(
abs(dgamma(x)) )
55 20
IF (y .GT. xmax) CALL
xermsg(
'SLATEC',
'DLNGAM',
56 +
'ABS(X) SO BIG DLNGAM OVERFLOWS', 2, 2)
58 IF (x.GT.0.d0) dlngam = sq2pil + (x-0.5d0)*
log(x) - x + d9lgmc(y)
62 IF (sinpiy .EQ. 0.d0) CALL
xermsg(
'SLATEC',
'DLNGAM',
63 +
'X IS A NEGATIVE INTEGER', 3, 2)
65 IF (
abs((x-aint(x-0.5d0))/x) .LT. dxrel) CALL
xermsg(
'SLATEC',
67 +
'ANSWER LT HALF PRECISION BECAUSE X TOO NEAR NEGATIVE INTEGER',
70 dlngam = sqpi2l + (x-0.5d0)*
log(y) - x -
log(sinpiy) - d9lgmc(y)
octave_value log(void) const
octave_value sin(void) const
subroutine xermsg(LIBRAR, SUBROU, MESSG, NERR, LEVEL)
octave_value sqrt(void) const