#pragma -xO
! @file zeroin.f
! From demo
! Adapted for VIF beta-0.9.45
! Tuesday 30 July 2024
!
      program zeroes
      implicit real*8 (a - h, o - z)
      external zeroin, x2
      intrinsic dcos
      tol = 10 * d1mach (4)
      x = zeroin (1.d0, 2.d0, dcos, tol, ierr)
      write (*, *) ierr, ' ', x
      x = zeroin (-2.d0, -1.d0, dcos, tol, ierr)
      write (*, *) ierr, ' ', x
      x = zeroin (1.d0, 2.d0, x2, tol, ierr)
      write (*, *) ierr, ' ', x
      x = zeroin (-1.d0, 0.d0, x2, tol, ierr)
      write (*, *) ierr, ' ', x
      end

      real*8 function x2 (x)
      implicit double precision (a-h, o-z)
      x2 = x ** 2 - 2
      return
      end
