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 for PR 15619


On Sunday 30 May 2004 17:36, Steve Kargl wrote:
> On Sun, May 30, 2004 at 09:24:19AM -0700, Steve Kargl wrote:
> > On Sun, May 30, 2004 at 11:52:51AM +0100, Paul Brook wrote:
> > > > See attached.
> > > > fortran.diff is applied to gcc/fortran.
> > > > random.c.diff is applied to random.c
> > >
> > > I tweaked the int->float conversion routines, and applied as follows.
> > >
> > > Paul
> >
> > Thanks!  But, your tweaking has broken the REAL(8) version.
>
> I also failed to point out that your tweak has invalidated the comments
> concerning the numerical range of [0,1).  The new numerical range with
> your code is (0,1].

The range is [0,1) once the typo is fixed (condition should be == 1.0 like the 
real*4 version).

>       kiss = kiss_random_kernel ();
>       *x = (GFC_REAL_4)kiss / (GFC_REAL_4)(~(GFC_UINTEGER_4) 0);
>
> kiss falls into the range [1,~(GFC_UINTEGER_4) 0].

The following seeds give values of 0 and ~0 respectively:

0xcffbf6eb, 0x0c2ff953, 0x44e8865d, 0x27ca3f8f
0x42b4f81f, 0xf908d0a3, 0x0f41c8c8, 0x3bcd41b3

So either the documentation or implementation of kiss_random_kernel is 
incorrect.

Paul


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