Program s22befe
! S22BEF Example Program Text
! Mark 27.1 Release. NAG Copyright 2020.
! .. Use Statements ..
Use nag_library, Only: nag_wp, s22bef
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nout = 6
! .. Local Scalars ..
Real (Kind=nag_wp) :: a, b, c, f, x
Integer :: ifail, kx
! .. Intrinsic Procedures ..
Intrinsic :: real
! .. Executable Statements ..
Write (nout,*) 'S22BEF Example Program Results'
a = 1.2E0_nag_wp
b = -2.6E0_nag_wp
c = 3.5E0_nag_wp
Write (nout,*)
Write (nout,99999)
Write (nout,99998)
Write (nout,99997) a, b, c
Write (nout,*)
Write (nout,99996)
Write (nout,99995)
Do kx = 1, 21
x = -4.0E0_nag_wp + real(kx-1,kind=nag_wp)*0.25E0_nag_wp
ifail = 1
f = s22bef(a,b,c,x,ifail)
Select Case (ifail)
Case (0,1,2,3)
Write (nout,99994) x, f
Case (4,5,6)
If (f>=0.0E0_nag_wp) Then
Write (nout,99993) x, '+Infinity'
Else
Write (nout,99993) x, '-Infinity'
End If
Case (9)
Write (nout,99993) x, 'NaN'
Case Default
Write (nout,*) 'Illegal parameter: ifail = ', ifail
Go To 100
End Select
End Do
100 Continue
99999 Format (12X,'a',14X,'b',14X,'c')
99998 Format (3('+--------------'),'+')
99997 Format (3(4X,F10.2,1X))
99996 Format (12X,'x',4X,'2F1(a,b;c;x)')
99995 Format (2('+--------------'),'+')
99994 Format (4X,F10.2,5X,F10.4)
99993 Format (4X,F10.2,3X,A13)
End Program s22befe