      program TDGINTGRL1
      implicit real*8(a-h,o-z)
      
      parameter (m=100000)
      real*8 y,y2,x,r0,f(0:m)
      integer n
c----------------------------------------------------------------------
c TDGINTGRL1 tests the integration routine DGINTGRL1 for different values 
c of the integration boundary

      
c the function to be integrated is exp(-1d-2*x) from x to 
c infinity

      n = 100
      r0 = 5d1

      write(*,*) '# of gridpoints:',n,'  grid parameter r0 =',r0

      dy = 1d0/dfloat(n)

      do j=5,100,10
         x = j
      
         do i=1,n
            y = i*dy
c  evaluate function on gridpoints
            y2 = (r0+x)/y - r0
            f(i) = exp(-1d-2*y2)
         enddo
      
c  call subroutine
         
      z=dgintgrl2(n,r0,f,x)

c  write output
      
      write(*,4000) x,z-1d2*(exp(-1d-2*x))

 4000 format('x=',F5.0,'   abs. error:',F20.15)
      enddo




      stop
      end




