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

NAG AD Library Introduction
Example description
    Program s01ba_p0w_fe

!     S01BA_P0W_F Example Program Text
!     Mark 30.0 Release. NAG Copyright 2024.

!     .. Use Statements ..
      Use iso_c_binding, Only: c_ptr
      Use nagad_library, Only: s01ba_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)               :: x, y
      Integer                          :: i, ifail, n
!     .. Executable Statements ..
      Write (nout,*) 'S01BA_P0W_F Example Program Results'

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

      Write (nout,*)
      Write (nout,*) '       x       y=ln(1+x)'
      Do i = 1, n
        Read (nin,*) x

        ifail = -1
        Call s01ba_p0w_f(ad_handle,x,y,ifail)
        If (ifail<0) Then
          Write (nout,99999) x, 'fail = ', ifail
        Else
          Write (nout,99998) x, y
        End If
      End Do
99999 Format (1X,1P,E12.4,1X,A12,I0)
99998 Format (1X,1P,2E12.4)

    End Program s01ba_p0w_fe