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

NAG FL Interface Introduction
Example description
    Program s14acfe

!     S14ACF Example Program Text

!     Mark 30.3 Release. nAG Copyright 2024.

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

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

      Write (nout,*)
      Write (nout,*) '       X        psi(X)-log(X)'
      Write (nout,*)

data: Do
        Read (nin,*,Iostat=ioerr) x

        If (ioerr<0) Then
          Exit data
        End If

        ifail = -1
        f = s14acf(x,ifail)

        If (ifail<0) Then
          Exit data
        End If

        Write (nout,99999) x, f
      End Do data

99999 Format (1X,F12.4,F15.4)
    End Program s14acfe