2 SUBROUTINE DGAMLM
(XMIN
, XMAX
)
3 C***BEGIN PROLOGUE DGAMLM
4 C***PURPOSE Compute the minimum and maximum bounds for the argument in
6 C***LIBRARY SLATEC (FNLIB)
8 C***TYPE DOUBLE PRECISION (GAMLIM-S, DGAMLM-D)
9 C***KEYWORDS COMPLETE GAMMA FUNCTION, FNLIB, LIMITS, SPECIAL FUNCTIONS
10 C***AUTHOR Fullerton, W., (LANL)
13 C Calculate the minimum and maximum legal bounds for X in gamma(X).
14 C XMIN and XMAX are not the only bounds, but they are the only non-
15 C trivial ones to calculate.
18 C XMIN double precision minimum legal value of X in gamma(X). Any
19 C smaller value of X might result in underflow.
20 C XMAX double precision maximum legal value of X in gamma(X). Any
21 C larger value of X might cause overflow.
24 C***ROUTINES CALLED D1MACH, XERMSG
25 C***REVISION HISTORY (YYMMDD)
27 C 890531 Changed all specific intrinsics to generic. (WRB)
28 C 890531 REVISION DATE from Version 3.2
29 C 891214 Prologue converted to Version 4.0 format. (BAB)
30 C 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
31 C***END PROLOGUE DGAMLM
32 DOUBLE PRECISION XMIN
, XMAX
, ALNBIG
, ALNSML
, XLN
, XOLD
, D1MACH
33 C***FIRST EXECUTABLE STATEMENT DGAMLM
34 ALNSML
= LOG
(D1MACH
(1))
39 XMIN
= XMIN
- XMIN*
((XMIN
+0.5D0
)*XLN
- XMIN
- 0.2258D0
+ ALNSML
)
41 IF (ABS
(XMIN
-XOLD
).LT
.0.005D0
) GO TO 20
43 CALL XERMSG
('SLATEC', 'DGAMLM', 'UNABLE TO FIND XMIN', 1, 2)
45 20 XMIN
= -XMIN
+ 0.01D0
47 ALNBIG
= LOG
(D1MACH
(2))
52 XMAX
= XMAX
- XMAX*
((XMAX
-0.5D0
)*XLN
- XMAX
+ 0.9189D0
- ALNBIG
)
54 IF (ABS
(XMAX
-XOLD
).LT
.0.005D0
) GO TO 40
56 CALL XERMSG
('SLATEC', 'DGAMLM', 'UNABLE TO FIND XMAX', 2, 2)
58 40 XMAX
= XMAX
- 0.01D0
59 XMIN
= MAX
(XMIN
, -XMAX
+1.D0
)