Blame view

fvn_fnlib/r9gaml.f 1.29 KB
38581db0c   daniau   git-svn-id: https...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
        subroutine r9gaml (xmin, xmax)
  c april 1977 version.  w. fullerton, c3, los alamos scientific lab.
  c
  c calculate the minimum and maximum legal bounds for x in gamma(x).
  c xmin and xmax are not the only bounds, but they are the only non-
  c trivial ones to calculate.
  c
  c             output arguments --
  c xmin   minimum legal value of x in gamma(x).  any smaller value of
  c        x might result in underflow.
  c xmax   maximum legal value of x in gamma(x).  any larger value will
  c        cause overflow.
  c
        external  r1mach
  c
        alnsml = alog(r1mach(1))
        xmin = -alnsml
        do 10 i=1,10
          xold = xmin
          xln = alog(xmin)
          xmin = xmin - xmin*((xmin+0.5)*xln - xmin - 0.2258 + alnsml)
       1    / (xmin*xln + 0.5)
          if (abs(xmin-xold).lt.0.005) go to 20
   10   continue
        call seteru (27hr9gaml  unable to find xmin, 27, 1, 2)
  c
   20   xmin = -xmin + 0.01
  c
        alnbig = alog(r1mach(2))
        xmax = alnbig
        do 30 i=1,10
          xold = xmax
          xln = alog(xmax)
          xmax = xmax - xmax*((xmax-0.5)*xln - xmax + 0.9189 - alnbig)
       1    / (xmax*xln - 0.5)
          if (abs(xmax-xold).lt.0.005) go to 40
   30   continue
        call seteru (27hr9gaml  unable to find xmax, 27, 2, 2)
  c
   40   xmax = xmax - 0.01
        xmin = amax1 (xmin, -xmax+1.)
  c
        return
        end