c---
c   file: bescheck.f
c   purpose:   to test r8slatec bessel routines as replacements for imsl routines.
c   author: J. C. Wiley 6/20/01
c---
      use kind_spec
      implicit none
      integer k, j
      real(kind=dp) work(101), work2(101)
      real(kind=dp) ix(10)
      integer ik(5)
      integer iier, ier
      integer nli
      real(kind=dp) diff
      integer jj, jjj
c--- rsla library constants
      print*,'d1mach1 ',d1mach1
      print*,'d1mach2 ',d1mach2
      print*,'d1mach3 ',d1mach3
      print*,'d1mach4 ',d1mach4
      print*,'d1mach5 ',d1mach5
c---
c    Sample values for mmbsir called from mlibfn.f
c    Typical value nli = 101, x from 0.01 to 100
c---
      nli = 101
      ix(1) = 0.01
      ix(2) = 0.05
      ix(3) = 1.0
      ix(4) = 5.0
      ix(5) = 10.0
      ix(6) = 20.0
      ix(7) = 40.0
      ix(8) = 60.0
      ix(9) = 90.0
      ix(10)= 100.0
      ik(1) = 1
      ik(2) = 5
      ik(3) = 50
      ik(4) = 90
      ik(5) = 100
      print *,' compare mmbsir and dbesi '
      print *,'   x, nu, e_imsl, e_r8, imsl, slatec, delta'
      do k=1,10
        call mmbsir(ix(k), 0.0, nli, 2, work, iier)
        if(iier .gt. 129) then
        jj = iier -129
        do jjj= jj, nli
          work(jjj) = 0
        end do
        end if
        call dbesi(ix(k), 0.0, 2, nli, work2, ier)
        if(ier .gt. 0) then
          do jjj = ier, nli
            work2(jjj) = 0
          end do
        end if
c-------------------------------------------------------------------------
        do j = 1, 5
          diff= work(ik(j))-work2(ik(j))
          print 600,ix(k),ik(j),iier,ier,work(ik(j)),work2(ik(j)),diff
        end do
      enddo
  600 format(f8.2, i4 ,i4, i4, e21.13, e21.13, e21.13)
c---
c    Sample value for mmbskr called from orbit.f
c    Typical values for x are from 861 to 950
c---
      print *, 'compare mmbskr and dbesk '
      ix(1) = 700
      ix(2) = 800
      ix(3) = 850
      ix(4) = 900
      ix(5) = 950
      do k=1,5
        call mmbskr(ix(k), 0.0, 3, work, ier)
        call dbesk(ix(k), 0.0, 2, 3, work2, iier)
        do j = 1, 3
          diff = work(j)-work2(j)
          print 600,ix(k),j,iier,ier,work(j), work2(j),diff
        end do
      end do
      end

