      FUNCTION TRP(A,N,X,Y)
      DIMENSION X(N),Y(N)
C
      NM1 = N-1
      IF (A.LT.X(2)) GO TO 50
      IF (A.GE.X(NM1)) GO TO 40
      IL = 2
      IR = NM1
C
C     BISECTION SEARCH
C
   10 I = (IL+IR)/2
      IF (I.EQ.IL) GO TO 60
      IF (A-X(I)) 20,60,30
   20 IR = I
      GO TO 10
   30 IL = I
      GO TO 10
C
C     A.LT.X(2) .OR. A.GE.X(N-1)
C
   40 I = NM1
      GO TO 60
   50 I = 1
C
C     EVALUATION
C
   60 R = (A-X(I))/(X(I+1)-X(I))
      TRP = Y(I)+R*(Y(I+1)-Y(I))
      RETURN
      END
