| 1 |
! { dg-do run { xfail *-*-mingw* } } |
| 2 |
! { dg-add-options ieee } |
| 3 |
! |
| 4 |
! PR fortran/36158 |
| 5 |
! PR fortran/33197 |
| 6 |
! |
| 7 |
! For mingw targets this test is disabled as the MS implementation |
| 8 |
! of BESSEL_YN(n,x) has different results. It returns NAN rather than |
| 9 |
! -INF for "x=0.0" and all "n". |
| 10 |
! |
| 11 |
! Run-time tests for transformations BESSEL_YN |
| 12 |
! |
| 13 |
implicit none |
| 14 |
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] |
| 15 |
real,parameter :: myeps(size(values)) = epsilon(0.0) & |
| 16 |
* [2, 3, 4, 5, 8, 2, 13, 6, 7, 6, 36, 168 ] |
| 17 |
! The following is sufficient for me - the values above are a bit |
| 18 |
! more tolerant |
| 19 |
! * [0, 0, 0, 3, 3, 0, 9, 0, 2, 1, 22, 130 ] |
| 20 |
integer,parameter :: nit(size(values)) = & |
| 21 |
[100, 100, 100, 25, 15, 100, 10, 31, 7, 100, 7, 25 ] |
| 22 |
integer, parameter :: Nmax = 100 |
| 23 |
real :: rec(0:Nmax), lib(0:Nmax) |
| 24 |
integer :: i |
| 25 |
|
| 26 |
do i = 1, ubound(values,dim=1) |
| 27 |
call compare(values(i), myeps(i), nit(i), 6*epsilon(0.0)) |
| 28 |
end do |
| 29 |
|
| 30 |
contains |
| 31 |
|
| 32 |
subroutine compare(X, myeps, nit, myeps2) |
| 33 |
|
| 34 |
integer :: i, nit |
| 35 |
real X, myeps, myeps2 |
| 36 |
|
| 37 |
rec = BESSEL_YN(0, Nmax, X) |
| 38 |
lib = [ (BESSEL_YN(i, X), i=0,Nmax) ] |
| 39 |
|
| 40 |
!print *, 'YN for X = ', X, ' -- Epsilon = ',epsilon(x) |
| 41 |
do i = 0, Nmax |
| 42 |
! print '(i2,2e17.9,e12.2,f14.10,2l3)', i, rec(i), lib(i), & |
| 43 |
! rec(i)-lib(i), ((rec(i)-lib(i))/rec(i))/epsilon(x), & |
| 44 |
! i > nit .or. rec(i) == lib(i) & |
| 45 |
! .or. abs((rec(i)-lib(i))/rec(i)) < myeps2, & |
| 46 |
! rec(i) == lib(i) .or. abs((rec(i)-lib(i))/rec(i)) < myeps |
| 47 |
if (.not. (i > nit .or. rec(i) == lib(i) & |
| 48 |
.or. abs((rec(i)-lib(i))/rec(i)) < myeps2)) & |
| 49 |
STOP 1 |
| 50 |
if (.not. (rec(i) == lib(i) .or. abs((rec(i)-lib(i))/rec(i)) < myeps)) & |
| 51 |
STOP 2 |
| 52 |
end do |
| 53 |
|
| 54 |
end |
| 55 |
end |