      subroutine algams (x, algam, sgngam)
c july 1977 edition.  w. fullerton, c3, los alamos scientific lab.
c
c evaluate log abs (gamma(x)) and return the sign of gamma(x) in sgngam.
c sgngam is either +1.0 or -1.0.
c
      external aint, alngam
c
      algam = alngam(x)
      sgngam = 1.0
      if (x.gt.0.0) return
c
      int = amod (-aint(x), 2.0) + 0.1
      if (int.eq.0) sgngam = -1.0
c
      return
      end