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

NAG AD Library Introduction
Example description
    Program g01gc_p0w_fe

!     G01GC_P0W_F Example Program Text
!     Mark 28.5 Release. NAG Copyright 2022.

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

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

      Write (nout,99999) 'x', 'df', 'rlamda', 'p'
99999 Format (1X,A5,A8,A10,A6)

      tol = 0.0E0_nag_wp
      maxit = 100
      Do i = 1, n
        Read (nin,*) x, df, rlamda

!       Calculate probability
        ifail = 0
        Call g01gc_p0w_f(ad_handle,x,df,rlamda,tol,maxit,p,ifail)

        ifail = 0
        Write (nout,99998) x, df, rlamda, p
      End Do
99998 Format (1X,4(F7.2,1X))

    End Program g01gc_p0w_fe