This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[gfortran] PATCH -- fix random.c, again.
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Sun, 30 May 2004 10:39:38 -0700
- Subject: [gfortran] PATCH -- fix random.c, again.
The attached patch fixes an infinite loop in RANDOM_NUMBER
and it restores the division of two type casted uint32_t
integers to ensure that single and double precision RANDOM_NUMBER
routines return compatible sequences of numbers for the
same seeds. IMNSHO, it is more important for this program
program s
real(4) x(2)
real(8) y(2)
call random_seed
call random_number(x)
call random_seed
call random_number(y)
print*, x(2), y(2)
end program
to produce
0.651118E+00 0.651118037442471E+00
than
0.651118E+00 0.827013908612312E-01
where the 0.82... is produced via the division of two
type casted unit64_t integers.
2004-05-30 Steven G. Kargl <kargls@comcast.net>
* random.c (random_r8): Remove infinite loop and restore division of
type cast uint32_t values.
--
Steve