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

NAG FL Interface Introduction
Example description
    Program s21bdfe

!     S21BDF Example Program Text

!     Mark 30.3 Release. nAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: nag_wp, s21bdf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: r, rj, x, y, z
      Integer                          :: ifail, ix, iy, iz
!     .. Intrinsic Procedures ..
      Intrinsic                        :: real
!     .. Executable Statements ..
      Write (nout,*) 'S21BDF Example Program Results'

      Write (nout,*)
      Write (nout,*) '    X      Y      Z      R        S21BDF'
      Write (nout,*)

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

        Do iy = ix, 3
          y = real(iy,kind=nag_wp)*0.5E0_nag_wp

          Do iz = iy, 3
            z = real(iz,kind=nag_wp)*0.5E0_nag_wp
            r = 2.0E0_nag_wp

            ifail = -1
            rj = s21bdf(x,y,z,r,ifail)

            If (ifail<0) Then
              Exit data
            End If

            Write (nout,99999) x, y, z, r, rj
          End Do

        End Do

      End Do data

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