6 ! Run-time tests for transformations BESSEL_YN
9 real,parameter :: values(*) = [0.0, 0.5, 1.0, 0.9, 1.8,2.0,3.0,4.0,4.25,8.0,34.53, 475.78]
10 real,parameter :: myeps(size(values
)) = epsilon(0.0) &
11 * [2, 3, 4, 5, 8, 2, 12, 6, 7, 6, 30, 168 ]
12 ! The following is sufficient for me - the values above are a bit
14 ! * [0, 0, 0, 3, 3, 0, 9, 0, 2, 1, 22, 130 ]
15 integer,parameter :: nit(size(values
)) = &
16 [100, 100, 100, 25, 15, 100, 10, 31, 7, 100, 7, 25 ]
17 integer, parameter :: Nmax
= 100
18 real :: rec(0:Nmax
), lib(0:Nmax
)
21 do i
= 1, ubound(values
,dim
=1)
22 call compare(values(i
), myeps(i
), nit(i
), 6*epsilon(0.0))
27 subroutine compare(X
, myeps
, nit
, myeps2
)
32 rec
= BESSEL_YN(0, Nmax
, X
)
33 lib
= [ (BESSEL_YN(i
, X
), i
=0,Nmax
) ]
35 !print *, 'YN for X = ', X, ' -- Epsilon = ',epsilon(x)
37 ! print '(i2,2e17.9,e12.2,f14.10,2l3)', i, rec(i), lib(i), &
38 ! rec(i)-lib(i), ((rec(i)-lib(i))/rec(i))/epsilon(x), &
39 ! i > nit .or. rec(i) == lib(i) &
40 ! .or. abs((rec(i)-lib(i))/rec(i)) < myeps2, &
41 ! rec(i) == lib(i) .or. abs((rec(i)-lib(i))/rec(i)) < myeps
42 if (.not
. (i
> nit
.or
. rec(i
) == lib(i
) &
43 .or
. abs((rec(i
)-lib(i
))/rec(i
)) < myeps2
)) &
45 if (.not
. (rec(i
) == lib(i
) .or
. abs((rec(i
)-lib(i
))/rec(i
)) < myeps
)) &