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

NAG FL Interface Introduction
Example description
    Program g01fcfe

!     G01FCF Example Program Text

!     Mark 28.3 Release. NAG Copyright 2022.

!     .. Use Statements ..
      Use nag_library, Only: g01fcf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: df, p, x
      Integer                          :: ifail
!     .. Executable Statements ..
      Write (nout,*) 'G01FCF Example Program Results'
      Write (nout,*)

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

!     Display titles
      Write (nout,*) '     P       DF      X'
      Write (nout,*)

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

!       Calculate deviates (inverse CDF)
        ifail = -1
        x = g01fcf(p,df,ifail)
        If (ifail/=0) Then
          If (ifail/=4 .And. ifail/=5) Then
            Exit d_lp
          End If
        End If

!       Display results
        Write (nout,99999) p, df, x
      End Do d_lp

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