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

NAG AD Library Introduction
Example description
    Program g01ec_p0w_fe

!     G01EC_P0W_F Example Program Text
!     Mark 27.2 Release. NAG Copyright 2021.

!     .. Use Statements ..
      Use iso_c_binding, Only: c_ptr
      Use nagad_library, Only: g01ec_p0w_f
      Use nag_library, Only: nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Type (c_ptr)                     :: ad_handle
      Real (Kind=nag_wp)               :: df, p, x
      Integer                          :: i, ifail, n
      Character (1)                    :: tail
!     .. Executable Statements ..
      Write (nout,*) 'G01EC_P0W_F Example Program Results'

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

      tail = 'L'
      Write (nout,*)
      Write (nout,*)
      Write (nout,*) '   x            df           p'

      Do i = 1, n
        Read (nin,*) x, df

        ifail = 0
        Call g01ec_p0w_f(ad_handle,tail,x,df,p,ifail)

        Write (nout,99999) x, p, df
      End Do
99999 Format (1X,1P,3E13.4)

    End Program g01ec_p0w_fe