| 1 |
! { dg-do run } |
| 2 |
! { dg-options "-Wall -fno-range-check" } |
| 3 |
! |
| 4 |
! PR fortran/36158 - Transformational BESSEL_JN/YN |
| 5 |
! PR fortran/33197 - F2008 math functions |
| 6 |
! |
| 7 |
! This is a dg-do run test as the middle end cannot simplify the |
| 8 |
! the scalarization of the elemental function (cf. PR 45305). |
| 9 |
! |
| 10 |
! -Wall has been specified to disabled -pedantic, which warns about the |
| 11 |
! negative order (GNU extension) to the order of the Bessel functions of |
| 12 |
! first and second kind. |
| 13 |
! |
| 14 |
|
| 15 |
implicit none |
| 16 |
integer :: i |
| 17 |
|
| 18 |
|
| 19 |
! Difference to mpfr_jn <= 1 epsilon |
| 20 |
|
| 21 |
if (any (abs (BESSEL_JN(2, 5, 2.457) - [(BESSEL_JN(i, 2.457), i = 2, 5)]) & |
| 22 |
> epsilon(0.0))) then |
| 23 |
print *, 'FAIL 1' |
| 24 |
STOP 1 |
| 25 |
end if |
| 26 |
|
| 27 |
|
| 28 |
! Difference to mpfr_yn <= 4 epsilon |
| 29 |
|
| 30 |
if (any (abs (BESSEL_YN(2, 5, 2.457) - [(BESSEL_YN(i, 2.457), i = 2, 5)]) & |
| 31 |
> epsilon(0.0)*4)) then |
| 32 |
STOP 2 |
| 33 |
end if |
| 34 |
|
| 35 |
|
| 36 |
! Difference to mpfr_jn <= 1 epsilon |
| 37 |
|
| 38 |
if (any (abs (BESSEL_JN(0, 10, 4.457) & |
| 39 |
- [ (BESSEL_JN(i, 4.457), i = 0, 10) ]) & |
| 40 |
> epsilon(0.0))) then |
| 41 |
STOP 3 |
| 42 |
end if |
| 43 |
|
| 44 |
|
| 45 |
! Difference to mpfr_yn <= 192 epsilon |
| 46 |
|
| 47 |
if (any (abs (BESSEL_YN(0, 10, 4.457) & |
| 48 |
- [ (BESSEL_YN(i, 4.457), i = 0, 10) ]) & |
| 49 |
> epsilon(0.0)*192)) then |
| 50 |
STOP 4 |
| 51 |
end if |
| 52 |
|
| 53 |
|
| 54 |
! Difference to mpfr_jn: None. (Special case: X = 0.0) |
| 55 |
|
| 56 |
if (any (BESSEL_JN(0, 10, 0.0) /= [ (BESSEL_JN(i, 0.0), i = 0, 10) ])) & |
| 57 |
then |
| 58 |
STOP 5 |
| 59 |
end if |
| 60 |
|
| 61 |
|
| 62 |
! Difference to mpfr_yn: None. (Special case: X = 0.0) |
| 63 |
|
| 64 |
if (any (BESSEL_YN(0, 10, 0.0) /= [ (BESSEL_YN(i, 0.0), i = 0, 10) ])) & |
| 65 |
then |
| 66 |
STOP 6 |
| 67 |
end if |
| 68 |
|
| 69 |
|
| 70 |
! Difference to mpfr_jn <= 1 epsilon |
| 71 |
|
| 72 |
if (any (abs (BESSEL_JN(0, 10, 1.0) & |
| 73 |
- [ (BESSEL_JN(i, 1.0), i = 0, 10) ]) & |
| 74 |
> epsilon(0.0)*1)) then |
| 75 |
STOP 7 |
| 76 |
end if |
| 77 |
|
| 78 |
! Difference to mpfr_yn <= 32 epsilon |
| 79 |
|
| 80 |
if (any (abs (BESSEL_YN(0, 10, 1.0) & |
| 81 |
- [ (BESSEL_YN(i, 1.0), i = 0, 10) ]) & |
| 82 |
> epsilon(0.0)*32)) then |
| 83 |
STOP 8 |
| 84 |
end if |
| 85 |
|
| 86 |
end |