r9lgic.f 737 Bytes
function r9lgic (a, x, alx)
c july 1977 edition.  w. fullerton, c3, los alamos scientific lab.
c
c compute the log complementary incomplete gamma function for large x
c and for a .le. x.
c
      external r1mach
      data eps / 0.0 /
c
      if (eps.eq.0.0) eps = 0.5*r1mach(3)
c
      xpa = x + 1.0 - a
      xma = x - 1.0 - a
c
      r = 0.0
      p = 1.0
      s = p
      do 10 k=1,200
        fk = k
        t = fk*(a-fk)*(1.0+r)
        r = -t/((xma+2.0*fk)*(xpa+2.0*fk)+t)
        p = r*p
        s = s + p
        if (abs(p).lt.eps*s) go to 20
 10   continue
      call seteru (57hr9lgic  no convergence in 200 terms of continued f
     1raction, 57, 1, 2)
c
 20   r9lgic = a*alx - x + alog(s/xpa)
c
      return
      end