      DOUBLE PRECISION FUNCTION INTSX(X0,X1,Y1,X2,Y2)
      DOUBLE PRECISION X0,X1,Y1,X2,Y2
      double precision eps
      parameter (eps = 1.0D-12)

      if (X2 .ne. X1) then
         INTSX=(Y2-Y1)/(X2-X1)*(X0-X1)+Y1
      else
         INTSX=(Y2-Y1)/(X2-X1+eps)*(X0-X1)+Y1
      endif
      RETURN
      END
