      program dsaqtest
      implicit none
      double precision f, dsaq, ans
      external f, dsaq
      double precision pi, epsilon, zero
      parameter(pi=3.1415926535897932d0, epsilon=1.0d-2, zero=0d0)
c     ..................................................................

      write(*,'(a f11.6)') 'Before call, e is ', epsilon
      ans= dsaq(f, 0d0, 2d0*pi, epsilon)
      write(*,'(a f11.6)') 'Integral is       ', ans
      write(*,'(a f11.6)') 'After  call, e is ', epsilon

      end ! program dsaqtest

      double precision function f(x)
      implicit none
      double precision x

      f=sqrt(1 + (cos(x)**2))
c     write (*, '(a f11.6 f11.6)') 'x, dcos(x): ', x, f
      end ! double precision function f
c     ..................................................................
