    PROGRAM g01erfe

!      G01ERF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. 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
