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

NAG FL Interface Introduction
Example description
    Program g01gefe

!     G01GEF Example Program Text

!     Mark 29.3 Release. NAG Copyright 2023.

!     .. Use Statements ..
      Use nag_library, Only: g01gef, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: a, b, prob, rlamda, tol, x
      Integer                          :: ifail, maxit
!     .. Executable Statements ..
      Write (nout,*) 'G01GEF Example Program Results'
      Write (nout,*)

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

!     Display titles
      Write (nout,*) '     X       A       B    RLAMDA   PROB'
      Write (nout,*)

!     Use default tolerance
      tol = 0.0E0_nag_wp
      maxit = 100

d_lp: Do
        Read (nin,*,Iostat=ifail) x, a, b, rlamda
        If (ifail/=0) Then
          Exit d_lp
        End If

!       Calculate probability
        ifail = -1
        prob = g01gef(x,a,b,rlamda,tol,maxit,ifail)
        If (ifail/=0) Then
          If (ifail<3) Then
            Exit d_lp
          End If
        End If

!       Display results
        Write (nout,99999) x, a, b, rlamda, prob
      End Do d_lp

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