      function cosdg (x)
c june 1977 edition.   w. fullerton, c3, los alamos scientific lab.
      external cos
      data raddeg / .017453292519943296e0 /
c
      cosdg = cos (raddeg*x)
c
      if (amod(x,90.).ne.0.) return
      n = abs(x)/90.0 + 0.5
      n = mod (n, 2)
      if (n.eq.0) cosdg = sign (1.0, cosdg)
      if (n.eq.1) cosdg = 0.0
c
      return
      end
