annotate gcc/testsuite/gfortran.dg/random_3.f90 @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ! { dg-do run }
kono
parents:
diff changeset
2 ! { dg-require-effective-target fortran_large_real }
kono
parents:
diff changeset
3 ! Check that the random_seed for real(10) exists and that
kono
parents:
diff changeset
4 ! real(8) and real(10) random number generators
kono
parents:
diff changeset
5 ! return the same sequence of values.
kono
parents:
diff changeset
6 ! Mostly copied from random_2.f90
kono
parents:
diff changeset
7 program random_3
kono
parents:
diff changeset
8 integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1)
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 integer, dimension(:), allocatable :: seed
kono
parents:
diff changeset
11 real(kind=8), dimension(10) :: r8
kono
parents:
diff changeset
12 real(kind=k), dimension(10) :: r10
kono
parents:
diff changeset
13 real, parameter :: delta = 1.d-10
kono
parents:
diff changeset
14 integer n
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 ! Run the test only if real(10) is available. With the current
kono
parents:
diff changeset
17 ! xorshift1024* PRNG the real(16) generator uses two uint64_t values
kono
parents:
diff changeset
18 ! for every real(16) value generated, and hence the sequences won't
kono
parents:
diff changeset
19 ! be the same as with real(4,8,10).
kono
parents:
diff changeset
20 if (k == 10) then
kono
parents:
diff changeset
21 call random_seed (size=n)
kono
parents:
diff changeset
22 allocate (seed(n))
kono
parents:
diff changeset
23 call random_seed (get=seed)
kono
parents:
diff changeset
24 ! Test both array valued and scalar routines.
kono
parents:
diff changeset
25 call random_number(r8)
kono
parents:
diff changeset
26 call random_number (r8(10))
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 ! Reset the seed and get the real(8) values.
kono
parents:
diff changeset
29 call random_seed (put=seed)
kono
parents:
diff changeset
30 call random_number(r10)
kono
parents:
diff changeset
31 call random_number (r10(10))
kono
parents:
diff changeset
32
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
33 if (any ((r8 - r10) .gt. delta)) STOP 1
111
kono
parents:
diff changeset
34 end if
kono
parents:
diff changeset
35 end program random_3