subroutine dlgams (x, dlgam, 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 double precision x, dlgam, sgngam, dint, dlngam external dlngam c dlgam = dlngam(x) sgngam = 1.0d0 if (x.gt.0.d0) return c int = dmod (-dint(x), 2.0d0) + 0.1d0 if (int.eq.0) sgngam = -1.0d0 c return end