2 DOUBLE PRECISION FUNCTION dgamit (A, X)
51 DOUBLE PRECISION a,
x, aeps, ainta, algap1, alneps, alng, alx,
52 1 bot, h, sga, sgngam, sqeps, t,
d1mach,
dgamr,
d9gmit,
d9lgit,
55 SAVE alneps, sqeps, bot,
first
65 IF (
x .LT. 0.d0) CALL
xermsg(
'SLATEC',
'DGAMIT',
'X IS NEGATIVE'
68 IF (
x.NE.0.d0) alx =
log(
x)
70 IF (a.NE.0.d0) sga = sign(1.0d0, a)
71 ainta = aint(a + 0.5d0*sga)
74 IF (
x.GT.0.d0) go to 20
76 IF (ainta.GT.0.d0 .OR. aeps.NE.0.d0)
dgamit =
dgamr(a+1.0d0)
79 20
IF (
x.GT.1.d0) go to 30
80 IF (a.GE.(-0.5d0) .OR. aeps.NE.0.d0) CALL
dlgams(a+1.0d0, algap1,
85 30
IF (a.LT.
x) go to 40
96 IF (aeps.EQ.0.d0 .AND. ainta.LE.0.d0) go to 50
98 CALL
dlgams(a+1.0d0, algap1, sgngam)
99 t =
log(
abs(a)) + alng - algap1
100 IF (t.GT.alneps) go to 60
102 IF (t.GT.(-alneps)) h = 1.0d0 - sga * sgngam *
exp(t)
103 IF (
abs(h).GT.sqeps) go to 50
106 CALL
xermsg(
'SLATEC',
'DGAMIT',
'RESULT LT HALF PRECISION', 1,
109 50 t = -a*alx +
log(
abs(h))