      double precision function DINTRP(NN,DX,DY,DXX,MMM)
      integer NN
      double precision DX(NN),DY(NN),DVD(20)
      double precision DZ,DEPS,D5,DXX,DW,DL,DSPLY
      integer L,M,MM,MMM,N
      include 'UNITS.INC'
      data DZ,DEPS,D5/00.D00,1.0D-12,0.5D00/
      DINTRP = DZ
      M = MMM
      N = NN
      if (DXX.lt.(DX(1)-DEPS)) go to 250
      if (M.lt.2.or.M.gt.20.or.NN.lt.2) go to 240
      L = 1
      if (NN.gt.M) go to 100
      M = NN
      go to 210
100   continue
      if (NN.ne.0) go to 110
      N = 1000
      go to 120
110   continue
      if (NN.gt.15) go to 150
120   continue
      L = 1
130   continue
      if (dabs(DXX-DX(L)).lt.DEPS) go to 230
      if (DXX.lt.DX(L)) go to 140
      L = L+1
      if (L.le.N) go to 130
      go to 250
140   continue
      L = L-1
      go to 200
150   continue
      if (DXX.gt.(DX(N)+DEPS)) go to 250
      L = N
      if (dabs(DXX-DX(N)).lt.DEPS) go to 230
      if (M.ne.N) go to 160
      L = 1
      go to 210
160   continue
      DW = dble(N)
      DW = DW*D5
      DL = DW
      L = N/2
170   continue
      DW = D5*DW
      if (dabs(DXX-DX(L)).lt.DEPS) go to 230
      if (DW.lt.D5) go to 190
      if (DXX.gt.DX(L)) go to 180
      DL = DL-DW
      L = idint(DL)
      go to 170
180   continue
      DL = DL+DW
      L = idint(DL)
      go to 170
190   continue
      if (DX(L).lt.DXX) go to 200
      L = L-1
      if (L.le.0) go to 250
      go to 190
200   continue
      L = L-M/2+1
      if (L.le.0) L = 1
      if (L.gt.(N-M+1)) L = N-M+1
210   continue
      if (M.eq.2) go to 220
      MM = M-1
      call DIVDIF (DX(L),DY(L),M,DVD)
      DINTRP = DSPLY(DVD,MM,DXX,DX(L))
      go to 260
220   continue
      DINTRP = (DXX-DX(L))/(DX(L+1)-DX(L))*(DY(L+1)-DY(L))+DY(L)
      go to 260
230   continue
      DINTRP = DY(L)
      go to 260
240   continue
      write (TTYOUT(MACHNO),5000)
5000  format (/' Invalid argument in DINTRP.')
      go to 260
250   continue
      write (TTYOUT(MACHNO),5010)
5010  format (/' DXX outside table.')
260   continue
      return
      end
