C
C     ..................................................................
C
C        SUBROUTINE CS
C
C        PURPOSE
C           COMPUTES THE FRESNEL INTEGRALS.
C
C        USAGE
C           CALL CS (C,S,X)
C
C        DESCRIPTION OF PARAMETERS
C           C     - THE RESULTANT VALUE C(X).
C           S     - THE RESULTANT VALUE S(X).
C           X     - THE ARGUMENT OF FRESNEL INTEGRALS
C                   IF X IS NEGATIVE, THE ABSOLUTE VALUE IS USED.
C
C        REMARKS
C           THE ARGUMENT VALUE X REMAINS UNCHANGED.
C
C        SUBROUTINES AND FUNCTION SUBPROGRAMS REQUIRED
C           NONE
C
C        METHOD
C           DEFINITION
C           C(X)=INTEGRAL(COS(T)/SQRT(2*LI*T) SUMMED OVER T FROM 0 TO X)
C           S(X)=INTEGRAL(SIN(T)/SQRT(I*LI*T) SUMMED OVER T FROM 0 TO X)
C           EVALUATION
C           USING DIFFERENT APPROXIMATIONS FOR X LESS THAN 4 AND X
C           GREATER THAN 4.
C           REFERENCE
C           'COMPUTATION OF FRESNEL INTEGRALS' BY BOERSMA,
C           MATHEMATICAL TABLES AND OTHER AIDS TO COMPUTATION, VOL. 14,
C           1960, NO. 72, P. 380.
C
C     ..................................................................
C
      SUBROUTINE CS(C,S,X)
      Z=ABS(X)
      IF(Z-4.)1,1,2
    1 C=SQRT(Z)
      S=Z*C
      Z=(4.-Z)*(4.+Z)
      C=C*((((((5.100785E-11*Z+5.244297E-9)*Z+5.451182E-7)*Z
     1+3.273308E-5)*Z+1.020418E-3)*Z+1.102544E-2)*Z+1.840965E-1)
      S=S*(((((6.677681E-10*Z+5.883158E-8)*Z+5.051141E-6)*Z
     1+2.441816E-4)*Z+6.121320E-3)*Z+8.026490E-2)
      RETURN
    2 D=COS(Z)
      S=SIN(Z)
      Z=4./Z
      A=(((((((8.768258E-4*Z-4.169289E-3)*Z+7.970943E-3)*Z-6.792801E-3)
     1*Z-3.095341E-4)*Z+5.972151E-3)*Z-1.606428E-5)*Z-2.493322E-2)*Z
     2-4.444091E-9
      B=((((((-6.633926E-4*Z+3.401409E-3)*Z-7.271690E-3)*Z+7.428246E-3)
     1*Z-4.027145E-4)*Z-9.314910E-3)*Z-1.207998E-6)*Z+1.994711E-1
      Z=SQRT(Z)
      C=0.5+Z*(D*A+S*B)
      S=0.5+Z*(S*A-D*B)
      RETURN
      END
