random.c (random_r4): Burn a random number.

2004-06-13  Steven G. Kargl  <kargls@comcast.net>

* random.c (random_r4): Burn a random number.
(random_r8): fix infinite loop.

From-SVN: r83062
This commit is contained in:
Tobias Schlüter 2004-06-13 19:48:23 +02:00
parent 132da1a5aa
commit 9d409075cb
2 changed files with 10 additions and 2 deletions

View File

@ -1,4 +1,9 @@
2004-6-12 Bud Davis <bdavis9659@comcast.net>
2004-06-13 Steven G. Kargl <kargls@comcast.net>
* random.c (random_r4): Burn a random number.
(random_r8): fix infinite loop.
2004-06-12 Bud Davis <bdavis9659@comcast.net>
Steve Kargl <sgk@troutmask.apl.washington.edu>
PR gfortran/15292

View File

@ -462,6 +462,9 @@ prefix(random_r4) (GFC_REAL_4 *x)
{
kiss = kiss_random_kernel ();
*x = (GFC_REAL_4)kiss / (GFC_REAL_4)(~(GFC_UINTEGER_4) 0);
/* Burn a random number, so the REAL*4 and REAL*8 functions
produce similar sequences of random numbers. */
kiss = kiss_random_kernel ();
}
while (*x == 1.0);
@ -482,7 +485,7 @@ prefix(random_r8) (GFC_REAL_8 *x)
+ kiss_random_kernel ();
*x = (GFC_REAL_8)kiss / (GFC_REAL_8)(~(GFC_UINTEGER_8) 0);
}
while (*x != 0);
while (*x == 0);
}