Program g01erfe

!     G01ERF Example Program Text

!     Mark 26 Release. NAG Copyright 2016.

!     .. Use Statements ..
      Use nag_library, Only: g01erf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: p, t, vk
      Integer                          :: ifail
!     .. Executable Statements ..
      Write (nout,*) 'G01ERF Example Program Results'
      Write (nout,*)

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

!     Display titles
      Write (nout,*) '      T          VK     Probability'
      Write (nout,*)

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

!       Calculate probability
        ifail = 0
        p = g01erf(t,vk,ifail)

!       Display the results
        Write (nout,99999) t, vk, p
      End Do d_lp

99999 Format (F10.4,2X,F10.4,2X,F10.4)
    End Program g01erfe