    Program s21bafe

!     S21BAF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. Use Statements ..
      Use nag_library, Only: nag_wp, s21baf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: rc, x, y
      Integer                          :: ifail, ix
!     .. Intrinsic Procedures ..
      Intrinsic                        :: real
!     .. Executable Statements ..
      Write (nout,*) 'S21BAF Example Program Results'

      Write (nout,*)
      Write (nout,*) '    X      Y        S21BAF'
      Write (nout,*)

data: Do ix = 1, 3
        x = real(ix,kind=nag_wp)*0.5E0_nag_wp
        y = 1.0E0_nag_wp

        ifail = -1
        rc = s21baf(x,y,ifail)

        If (ifail<0) Then
          Exit data
        End If

        Write (nout,99999) x, y, rc
      End Do data

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