    PROGRAM c02akfe

!      C02AKF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : c02akf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (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,*) 'C02AKF Example Program Results'

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

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

       ifail = 0
       CALL c02akf(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 c02akfe
