    PROGRAM e01rbfe

!      E01RBF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : e01rbf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: m = 4, nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: f, x
       INTEGER                         :: i, ifail
!      .. Local Arrays ..
       REAL (KIND=nag_wp)              :: a(m), u(m)
!      .. Executable Statements ..
       WRITE (nout,*) 'E01RBF Example Program Results'

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

       READ (nin,*) (a(i),i=1,m)
       READ (nin,*) (u(i),i=1,m-1)
       READ (nin,*) x

       ifail = 0
       CALL e01rbf(m,a,u,x,f,ifail)

       WRITE (nout,*)
       WRITE (nout,99999) 'X =', x
       WRITE (nout,*)
       WRITE (nout,99999) 'The value of R(X) is ', f

99999  FORMAT (1X,A,1P,E12.4)
    END PROGRAM e01rbfe
