NAG Library Manual, Mark 28.3
Interfaces:  FL   CL   CPP   AD 

NAG FL Interface Introduction
Example description
    Program s21befe

!     S21BEF Example Program Text

!     Mark 28.3 Release. NAG Copyright 2022.

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

      Write (nout,*)
      Write (nout,*) '    PHI    DM      S21BEF'
      Write (nout,*)

      pi = x01aaf(pi)

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

        ifail = -1
        f = s21bef(phi,dm,ifail)

        If (ifail<0) Then
          Exit data
        End If

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

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