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

NAG FL Interface Introduction
Example description
    Program g01gdfe

!     G01GDF Example Program Text

!     Mark 30.3 Release. nAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: g01gdf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: df1, df2, f, prob, rlamda, tol
      Integer                          :: ifail, maxit
!     .. Executable Statements ..
      Write (nout,*) 'G01GDF Example Program Results'
      Write (nout,*)

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

!     Display titles
      Write (nout,*) '     F      DF1     DF2   RLAMDA   PROB'
      Write (nout,*)

!     Use default tolerance and suggested number of iterations
      tol = 0.0E0_nag_wp
      maxit = 100

d_lp: Do
        Read (nin,*,Iostat=ifail) f, df1, df2, rlamda
        If (ifail/=0) Then
          Exit d_lp
        End If

!       Calculate probability
        ifail = -1
        prob = g01gdf(f,df1,df2,rlamda,tol,maxit,ifail)
        If (ifail/=0) Then
          If (ifail<3) Then
            Exit d_lp
          End If
        End If

!       Display results
        Write (nout,99999) f, df1, df2, rlamda, prob
      End Do d_lp

99999 Format (1X,4F8.3,F8.4,A,I1)
    End Program g01gdfe