This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran] PATCH -- fix random.c, again.


On Sun, May 30, 2004 at 10:39:38AM -0700, Steve Kargl wrote:
> 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.
> 

I guess I ought to send the patch.

-- 
Steve

Attachment: random.c.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]