    Program c02amfe

!     C02AMF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. Use Statements ..
      Use nag_library, Only: c02amf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Complex (Kind=nag_wp)            :: r, s, t, u
      Integer                          :: i, ifail
!     .. Local Arrays ..
      Real (Kind=nag_wp)               :: errest(3), zeroi(3), zeror(3)
!     .. Executable Statements ..
      Write (nout,*) 'C02AMF Example Program Results'

!     Skip heading in data file
      Read (nin,*)

      Read (nin,*) u, r, s, t

      ifail = 0
      Call c02amf(u,r,s,t,zeror,zeroi,errest,ifail)

      Write (nout,*)
      Write (nout,*) ' Roots of cubic equation     ', &
        '        Error estimates'
      Write (nout,*) '                             ', &
        '      (machine-dependent)'
      Write (nout,*)

      Do i = 1, 3
        Write (nout,99999) ' z = ', zeror(i), zeroi(i), '*i', errest(i)
      End Do

99999 Format (1X,A,1P,E12.4,Sp,E12.4,A,8X,Ss,E9.1)
    End Program c02amfe
