[Patch libfortran/28452] random intrinsics for large reals

Brooks Moses bmoses@stanford.edu
Sun Jul 30 17:35:00 GMT 2006


A very very tiny comment: It seems to me that the formatting for the 
following two sections should be the same.  It might also be clearer to 
combine them into a single block, or to use the kiss_seed[i] = 
kiss_default_seed[i] assignment from random_seed instead.

I also wonder if it might not be better to use kiss_size rather than 
hardcoded numbers for the sizes, but that's a bit of programming style 
that I'm far less sure of (and I don't even know if it's legal C).

Actually, while I'm pondering style, I admit to a bit of curiousity as 
to why kiss_size and kiss_default_seed[] exist as variables at all, 
rather than merely doing "#define KISS_SIZE 12" (or 8) and using the 
#defined versions of KISS_DEFAULT_SEED_i directly in the random_seed 
function.

Thomas Koenig wrote:
> +#ifdef HAVE_GFC_REAL_16
> +
> +static GFC_UINTEGER_4 kiss_seed[12] = {
> +  KISS_DEFAULT_SEED_1,
> +  KISS_DEFAULT_SEED_2,
> +  KISS_DEFAULT_SEED_3
> +};
> +#else
> +static GFC_UINTEGER_4 kiss_seed[8] = {
> +  KISS_DEFAULT_SEED_1,
> +  KISS_DEFAULT_SEED_2
> +};
> +#endif
[...]
> +#ifdef HAVE_GFC_REAL_16
> +
> +static const GFC_UINTEGER_4 kiss_default_seed[12] =
> +  { KISS_DEFAULT_SEED_1, KISS_DEFAULT_SEED_2,
> +    KISS_DEFAULT_SEED_3};
> +
> +#else
>  
> +static const GFC_UINTEGER_4 kiss_default_seed[8] =
> +  { KISS_DEFAULT_SEED_1, KISS_DEFAULT_SEED_2 };
> +
> +#endif

- Brooks



More information about the Fortran mailing list