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

NAG FL Interface Introduction
Example description
    Program g01fdfe

!     G01FDF Example Program Text

!     Mark 30.3 Release. nAG Copyright 2024.

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

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

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

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

!       Calculate deviates (inverse CDF)
        ifail = -1
        f = g01fdf(p,df1,df2,ifail)
        If (ifail/=0) Then
          If (ifail/=3 .And. ifail/=4) Then
            Exit d_lp
          End If
        End If

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

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