NAG Library Manual, Mark 28.3
Interfaces:  FL   CL   CPP   AD 

NAG FL Interface Introduction
Example description
    Program s14adfe

!     S14ADF Example Program Text

!     Mark 28.3 Release. NAG Copyright 2022.

!     .. Use Statements ..
      Use nag_library, Only: nag_wp, s14adf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: m = 4, nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: x
      Integer                          :: i, ifail, ioerr, n
!     .. Local Arrays ..
      Real (Kind=nag_wp)               :: ans(m)
!     .. Executable Statements ..
      Write (nout,*) 'S14ADF Example Program Results'

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

      Write (nout,*)
      Write (nout,*) '      X           ANS(1)        ANS(2)        ',         &
        'ANS(3)        ANS(4)'
      Write (nout,*)

      n = 0

data: Do
        Read (nin,*,Iostat=ioerr) x

        If (ioerr<0) Then
          Exit data
        End If

        ifail = 0
        Call s14adf(x,n,m,ans,ifail)

        Write (nout,99999) x, (ans(i),i=1,m)
      End Do data

99999 Format (1X,1P,5(E12.4,2X))
    End Program s14adfe