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

NAG FL Interface Introduction
Example description
    Program g01mbfe

!     G01MBF Example Program Text

!     Mark 27.3 Release. NAG Copyright 2021.

!     .. Use Statements ..
      Use nag_library, Only: a00acf, g01mbf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: rm, x, xmu, xsig, z
      Integer                          :: ifail
!     .. Executable Statements ..
      Write (nout,*) 'G01MBF Example Program Results '
      Write (nout,*)

!     Check for valid licence prior to calling G01MBF
      If (.Not. a00acf()) Then
        Write (nout,*) ' ** A valid licence key was not found'

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

!       Display titles
        Write (nout,*) ' Mean     Sigma    X        Reciprocal'
        Write (nout,*) '                            Mills Ratio'
        Write (nout,*)

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

          z = (x-xmu)/xsig
          rm = g01mbf(z)/xsig

!         Display results
          Write (nout,99999) xmu, xsig, x, rm
        End Do d_lp
      End If

99999 Format (1X,4(F7.4,2X))
    End Program g01mbfe