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

NAG FL Interface Introduction
Example description
    Program g01fafe

!     G01FAF Example Program Text

!     Mark 30.3 Release. nAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: g01faf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: dev, p
      Integer                          :: ifail
      Character (1)                    :: tail
!     .. Executable Statements ..
      Write (nout,*) 'G01FAF Example Program Results'
      Write (nout,*)

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

!     Display titles
      Write (nout,*) ' Tail    Probability     Deviate '
      Write (nout,*)

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

!       Calculate the deviate (inverse CDF)
        ifail = 0
        dev = g01faf(tail,p,ifail)

!       Display results
        Write (nout,99999) tail, p, dev
      End Do d_lp

99999 Format (3X,A1,8X,F6.3,8X,F7.4)
    End Program g01fafe