Update ChangeLog and version files for release
[official-gcc.git] / gcc / testsuite / gfortran.dg / g77 / intrinsic-unix-bessel.f
blob696392ffac0f8c57291651578daa8aee67af840c
1 c { dg-do run }
2 c intrinsic-unix-bessel.f
4 c Test Bessel function intrinsics.
5 c These functions are only available if provided by system
7 c David Billinghurst <David.Billinghurst@riotinto.com>
9 real x, a
10 double precision dx, da
11 integer i
12 integer(kind=2) j
13 integer(kind=1) k
14 integer(kind=8) m
15 logical fail
16 common /flags/ fail
17 fail = .false.
19 x = 2.0
20 dx = x
21 i = 2
22 j = i
23 k = i
24 m = i
25 c BESJ0 - Bessel function of first kind of order zero
26 a = 0.22389077
27 da = a
28 call c_r(BESJ0(x),a,'BESJ0(real)')
29 call c_d(BESJ0(dx),da,'BESJ0(double)')
30 call c_d(DBESJ0(dx),da,'DBESJ0(double)')
32 c BESJ1 - Bessel function of first kind of order one
33 a = 0.57672480
34 da = a
35 call c_r(BESJ1(x),a,'BESJ1(real)')
36 call c_d(BESJ1(dx),da,'BESJ1(double)')
37 call c_d(DBESJ1(dx),da,'DBESJ1(double)')
39 c BESJN - Bessel function of first kind of order N
40 a = 0.3528340
41 da = a
42 call c_r(BESJN(i,x),a,'BESJN(integer,real)')
43 call c_r(BESJN(j,x),a,'BESJN(integer(2),real)')
44 call c_r(BESJN(k,x),a,'BESJN(integer(1),real)')
45 call c_d(BESJN(i,dx),da,'BESJN(integer,double)')
46 call c_d(BESJN(j,dx),da,'BESJN(integer(2),double)')
47 call c_d(BESJN(k,dx),da,'BESJN(integer(1),double)')
48 call c_d(DBESJN(i,dx),da,'DBESJN(integer,double)')
49 call c_d(DBESJN(j,dx),da,'DBESJN(integer(2),double)')
50 call c_d(DBESJN(k,dx),da,'DBESJN(integer(1),double)')
52 c BESY0 - Bessel function of second kind of order zero
53 a = 0.51037567
54 da = a
55 call c_r(BESY0(x),a,'BESY0(real)')
56 call c_d(BESY0(dx),da,'BESY0(double)')
57 call c_d(DBESY0(dx),da,'DBESY0(double)')
59 c BESY1 - Bessel function of second kind of order one
60 a = 0.-0.1070324
61 da = a
62 call c_r(BESY1(x),a,'BESY1(real)')
63 call c_d(BESY1(dx),da,'BESY1(double)')
64 call c_d(DBESY1(dx),da,'DBESY1(double)')
66 c BESYN - Bessel function of second kind of order N
67 a = -0.6174081
68 da = a
69 call c_r(BESYN(i,x),a,'BESYN(integer,real)')
70 call c_r(BESYN(j,x),a,'BESYN(integer(2),real)')
71 call c_r(BESYN(k,x),a,'BESYN(integer(1),real)')
72 call c_d(BESYN(i,dx),da,'BESYN(integer,double)')
73 call c_d(BESYN(j,dx),da,'BESYN(integer(2),double)')
74 call c_d(BESYN(k,dx),da,'BESYN(integer(1),double)')
75 call c_d(DBESYN(i,dx),da,'DBESYN(integer,double)')
76 call c_d(DBESYN(j,dx),da,'DBESYN(integer(2),double)')
77 call c_d(DBESYN(k,dx),da,'DBESYN(integer(1),double)')
79 if ( fail ) call abort()
80 end
82 subroutine failure(label)
83 c Report failure and set flag
84 character*(*) label
85 logical fail
86 common /flags/ fail
87 write(6,'(a,a,a)') 'Test ',label,' FAILED'
88 fail = .true.
89 end
91 subroutine c_r(a,b,label)
92 c Check if REAL a equals b, and fail otherwise
93 real a, b
94 character*(*) label
95 if ( abs(a-b) .gt. 1.0e-5 ) then
96 call failure(label)
97 write(6,*) 'Got ',a,' expected ', b
98 end if
99 end
101 subroutine c_d(a,b,label)
102 c Check if DOUBLE PRECISION a equals b, and fail otherwise
103 double precision a, b
104 character*(*) label
105 if ( abs(a-b) .gt. 1.0d-5 ) then
106 call failure(label)
107 write(6,*) 'Got ',a,' expected ', b
108 end if