      FUNCTION INTRVL (T,X,N)
      INTEGER N
      REAL T,X(N)
C-----------------------------------------------------------
C ON INPUT--
C
C   T IS A REAL NUMBER.
C
C   X IS A VECTOR OF STRICTLY INCREASING VALUES.
C
C   N IS THE LENGTH OF X (N .GE. 2).
C
C ON OUTPUT--
C
C   INTRVL RETURNS AN INTEGER I SUCH THAT
C
C          I = 1       IF             T .LT. X(2)
C          I = N-1     IF X(N-1) .LE. T
C          OTHERWISE       X(I)  .LE. T .LT. X(I+1)
C
C NONE OF THE INPUT PARAMETERS ARE ALTERED.
C-----------------------------------------------------------
C
      NM1 = N-1
      IF (T.LT.X(2)) GO TO 50
      IF (T.GE.X(NM1)) GO TO 60
      IL = 2
      IR = NM1
C
C BISECTION SEARCH
C
   10 I = (IL+IR)/2
      IF (I.EQ.IL) GO TO 40
      IF (T-X(I)) 20,40,30
   20 IR = I
      GO TO 10
   30 IL = I
      GO TO 10
   40 INTRVL = I
      RETURN
C
C LEFT END
C
   50 INTRVL = 1
      RETURN
C
C RIGHT END
C
   60 INTRVL = NM1
      RETURN
      END
