Program s01eafe

!     S01EAF Example Program Text

!     Mark 26.1 Release. NAG Copyright 2017.

!     .. Use Statements ..
      Use nag_library, Only: nag_wp, s01eaf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Complex (Kind=nag_wp)            :: w, z
      Integer                          :: ifail, ioerr
!     .. Executable Statements ..
      Write (nout,*) 'S01EAF Example Program Results'
      Write (nout,*)

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

      Write (nout,*) '              Z                              exp(Z)'

data: Do

        Read (nin,*,Iostat=ioerr) z

        If (ioerr<0) Then
          Exit data
        End If

        ifail = -1
        w = s01eaf(z,ifail)

        If (ifail<0) Then
          Exit data
        End If

        Write (nout,99999) z, w
      End Do data

99999 Format (1X,'(',F12.4,',',F12.4,')      (',F12.4,',',F12.4,')')
    End Program s01eafe