    Program s21bhfe

!     S21BHF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

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

      Write (nout,*)
      Write (nout,*) '    DM       S21BHF'
      Write (nout,*)

data: Do ix = 1, 3
        dm = real(ix,kind=nag_wp)*0.25E0_nag_wp

        ifail = -1
        f = s21bhf(dm,ifail)

        If (ifail<0) Then
          Exit data
        End If

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

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