      SUBROUTINE CAPO(X,Y,R,THETA)
      IF (ABS(X).LE.ABS(Y)) GO TO 10
      A=Y/X
      R=ABS(X)*SQRT(1.0+A*A)
      THETA=ATAN2(Y,X)
      RETURN
   10 IF (Y.EQ.0.) GO TO 20
      A=X/Y
      R=ABS(Y)*SQRT(1.0+A*A)
      THETA=ATAN2(Y,X)
      RETURN
   20 R=0.0
      THETA=0.0
      RETURN
      END
