      SUBROUTINE INTERV(XT,LXT,X,ILEFT,MFLAG)                           interv 3
C***BEGIN PROLOGUE  INTERV                                              interv 4
C***REFER TO  FC                                                        interv 5
C                                                                       interv 6
C Computes largest ILEFT in (1,LXT) such that XT(ILEFT) .LE. X          interv 7
C***ROUTINES CALLED  (NONE)                                             interv 8
C***END PROLOGUE  INTERV                                                interv 9
      IMPLICIT REAL*8 (A-H,O-Z)
      DIMENSION XT(LXT)                                                 interv10
      SAVE ILO                                                          interv11
      DATA ILO /1/                                                      interv12
C***FIRST EXECUTABLE STATEMENT  INTERV                                  interv13
      IHI = ILO + 1                                                     interv14
      IF (IHI .LT. LXT)                GO TO 20                         interv15
         IF (X .GE. XT(LXT))           GO TO 110                        interv16
         IF (LXT .LE. 1)               GO TO 90                         interv17
         ILO = LXT - 1                                                  interv18
                                       GO TO 21                         interv19
   20 IF (X .GE. XT(IHI))              GO TO 40                         interv20
   21 IF (X .GE. XT(ILO))              GO TO 100                        interv21
C *** NOW X .LT. XT(IHI) . FIND LOWER BOUND                             interv22
   30 ISTEP = 1                                                         interv23
   31 IHI = ILO                                                         interv24
      ILO = IHI - ISTEP                                                 interv25
      IF (ILO .LE. 1)                  GO TO 35                         interv26
      IF (X .GE. XT(ILO))              GO TO 50                         interv27
      ISTEP = ISTEP*2                                                   interv28
                                       GO TO 31                         interv29
   35 ILO = 1                                                           interv30
      IF (X .LT. XT(1))                GO TO 90                         interv31
                                       GO TO 50                         interv32
C *** NOW X .GE. XT(ILO) . FIND UPPER BOUND                             interv33
   40 ISTEP = 1                                                         interv34
   41 ILO = IHI                                                         interv35
      IHI = ILO + ISTEP                                                 interv36
      IF (IHI .GE. LXT)                GO TO 45                         interv37
      IF (X .LT. XT(IHI))              GO TO 50                         interv38
      ISTEP = ISTEP*2                                                   interv39
                                       GO TO 41                         interv40
   45 IF (X .GE. XT(LXT))              GO TO 110                        interv41
      IHI = LXT                                                         interv42
C *** NOW XT(ILO) .LE. X .LT. XT(IHI) . NARROW THE INTERVAL             interv43
   50 MIDDLE = (ILO + IHI)/2                                            interv44
      IF (MIDDLE .EQ. ILO)             GO TO 100                        interv45
C     NOTE. IT IS ASSUMED THAT MIDDLE = ILO IN CASE IHI = ILO+1         interv46
      IF (X .LT. XT(MIDDLE))           GO TO 53                         interv47
         ILO = MIDDLE                                                   interv48
                                       GO TO 50                         interv49
   53    IHI = MIDDLE                                                   interv50
                                       GO TO 50                         interv51
C *** SET OUTPUT AND RETURN                                             interv52
   90 MFLAG = -1                                                        interv53
      ILEFT = 1                                                         interv54
                                       RETURN                           interv55
  100 MFLAG = 0                                                         interv56
      ILEFT = ILO                                                       interv57
                                       RETURN                           interv58
  110 MFLAG = 1                                                         interv59
      ILEFT = LXT                                                       interv60
                                       RETURN                           interv61
      END                                                               interv62
