This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: [Patch libfortran/28452] random intrinsics for large reals


On Sat, Jul 29, 2006 at 05:58:56PM -0400, Jack Howarth wrote:
> 
> --- gcc-4.2-20060728/libgfortran/intrinsics/random.c    2006-07-29 17:52:22.000000000 -0400
> +++ gcc-4.2-20060728.random/libgfortran/intrinsics/random.c     2006-07-29 17:49:00.000000000 -0400
> @@ -132,7 +132,7 @@
>  /* For REAL(KIND=16), we only need to mask off the lower bits.  */
>  
>  static inline void
> -rnumber_16 (GFC_REAL_16 *v, GFC_UINTEGER_8 v1, GFC_UINTEGER_8 v2)
> +rnumber_16 (GFC_REAL_16 *f, GFC_UINTEGER_8 v1, GFC_UINTEGER_8 v2)
>  {
>    GFC_UINTEGER_8 mask;
>  #if GFC_REAL_16_RADIX == 2
> @@ -263,6 +263,7 @@
>  #ifdef HAVE_GFC_REAL_16
>  
>  static GFC_UINTEGER_4 * const kiss_seed_3 = kiss_seed + 8;
> +static GFC_UINTEGER_4 * const kiss_seed_4 = kiss_seed + 12;
>  
>  #endif
>  
> @@ -353,7 +354,7 @@
>  #ifdef HAVE_GFC_REAL_16
>  
>  void
> -random_r16 (GFC_REAL_10 *x)
> +random_r16 (GFC_REAL_16 *x)
>  {
>    GFC_UINTEGER_8 kiss1, kiss2;
>  
> @@ -362,7 +363,7 @@
>    kiss1 += kiss_random_kernel (kiss_seed_2);
>  
>    kiss2 = ((GFC_UINTEGER_8) kiss_random_kernel (kiss_seed_3)) << 32;
> -  kiss2 += kiss_random_kernel (kiss_seed_3);
> +  kiss2 += kiss_random_kernel (kiss_seed_4);
>  
>    rnumber_16 (x, kiss1, kiss2);
>    __gthread_mutex_unlock (&random_lock);
> 
> In particular, I added 12 to kiss_seed to obtain kiss_seed_4 and  noticed
> that you were adding using kiss_seed_3 twice when generating kiss2 (instead
> of using kiss_seed4.

I believe what you have done is correct.  This is why Thomas
asked for someone with real(16) to test the patch.


-- 
Steve


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