      FUNCTION COSDG (X)
C JUNE 1977 EDITION.   W. FULLERTON, C3, LOS ALAMOS SCIENTIFIC LAB.
      SAVE RADDEG
      DATA RADDEG / .017453292519943296E0 /
C
C***FIRST EXECUTABLE STATEMENT  COSDG
      COSDG = COS (RADDEG*X)
C
      IF (MOD(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
