      complex function cbeta (a, b)
c july 1977 edition.  w. fullerton, c3, los alamos scientific lab.
      complex a, b, cexp, cgamma, clbeta
      external cexp, cgamma, clbeta
      data xmax / 0.0 /
c
      if (xmax.eq.0.0) call r9gaml (xmin, xmax)
c
      if (real(a).le.0.0 .or. real(b).le.0.0) call seteru (
     1  48hcbeta   real part of both arguments must be gt 0, 48, 1, 2)
c
      if (real(a)+real(b).lt.xmax) cbeta = cgamma(a) * (cgamma(b)/
     1  cgamma(a+b) )
      if (real(a)+real(b).lt.xmax) return
c
      cbeta = cexp (clbeta(a, b))
c
      return
      end