      complex function cgamr (z)
c july 1977 edition.  w. fullerton, c3, los alamos scientific lab.
c this version is an inaccurate preliminary one.  eventually this
c routine should be a fundamental routine with no dependence on cgamma.
c
      complex z, cexp, clngam
      external aint, cexp, clngam
c
      cgamr = (0.0, 0.0)
      x = real (z)
      if (x.le.0.0 .and. aint(x).eq.x .and. 0.0.eq.aimag(z)) return
c
      call entsrc (irold, 1)
      cgamr = clngam(z)
      call erroff
      call entsrc (ir, irold)
      cgamr = cexp (-cgamr)
c
      return
      end