      FUNCTION ACOS(X)
C     WORK VIA THE ATAN FUNCTION AND SEC X
      PI=3.141592654
      PI2=PI/2.
      ACOS=PI2
      IF(X.EQ.0.) RETURN
      A=1./X
      A=A*A
      A=SQRT(A-1.)
      A=ATAN(A)
      ACOS=A
C     CHECK TO SEE IF A IS IN THE SECOND QUADRANT
      IF(X.LT.0.) ACOS=PI-ACOS
      RETURN
      END
