2016-01-15 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gfortran.dg / bessel_5.f90
blobaab45cafe17fd373776b9bcf2a175c00d0b9ad2a
1 ! { dg-do run }
2 ! { dg-options "-Wall -fno-range-check" }
4 ! PR fortran/36158 - Transformational BESSEL_JN/YN
5 ! PR fortran/33197 - F2008 math functions
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).
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.
15 implicit none
16 integer :: i
19 ! Difference to mpfr_jn <= 1 epsilon
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 call abort()
25 end if
28 ! Difference to mpfr_yn <= 4 epsilon
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 call abort()
33 end if
36 ! Difference to mpfr_jn <= 1 epsilon
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 call abort()
42 end if
45 ! Difference to mpfr_yn <= 192 epsilon
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 call abort()
51 end if
54 ! Difference to mpfr_jn: None. (Special case: X = 0.0)
56 if (any (BESSEL_JN(0, 10, 0.0) /= [ (BESSEL_JN(i, 0.0), i = 0, 10) ])) &
57 then
58 call abort()
59 end if
62 ! Difference to mpfr_yn: None. (Special case: X = 0.0)
64 if (any (BESSEL_YN(0, 10, 0.0) /= [ (BESSEL_YN(i, 0.0), i = 0, 10) ])) &
65 then
66 call abort()
67 end if
70 ! Difference to mpfr_jn <= 1 epsilon
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 call abort()
76 end if
78 ! Difference to mpfr_yn <= 32 epsilon
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 call abort()
84 end if
86 end