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

NAG FL Interface Introduction
Example description
    Program g01ecfe

!     G01ECF Example Program Text

!     Mark 28.3 Release. NAG Copyright 2022.

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

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

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

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

!       Calculate probability
        ifail = -1
        prob = g01ecf(tail,x,df,ifail)
        If (ifail/=0) Then
          If (ifail/=4) Then
            Exit d_lp
          End If
        End If

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

99999 Format (3X,A1,4X,F6.3,F8.1,7X,F7.4)
    End Program g01ecfe