[Ecls-list] Small problem with random on NetBSD/Sparc64

Bruce O'Neel edoneel at sdf.lonestar.org
Fri Jul 29 02:26:32 UTC 2005


Hi,

I think I see the bug.

In src/c/num_rand.d:

d = (double)(rs->random.value>>1) / (4294967296.0/2.0);

I can't easly find it, but, would .value happen to be a long?  If so
this expresion won't work when long is 8 bytes rather than 4 since
4294967296.0 looks just like 2^32 in float.

I'll try to produce a fix this evening.

cheers

bruce

On Fri, Jul 29, 2005 at 09:19:19AM +0000, Bruce O'Neel wrote:
> Hi,
> 
> There seems to be a small problem with (random ) on NetBSD/Sparc64
> that does not seem to exist on NetBSD/ppc, m68k, intel x86, or sparc.
> 
> On NetBSD/sparc (for example)
> 
> > (random 100)
> 8
> > (random 100)
> 27
> > (random 100)
> 74
> > 
> 
> but on NetBSD/Sparc64
> 
> > (random 100)
> 260094612668
> > (random 100)
> 27292043960
> > (random 100)
> 397829141684
> 
> I'll poke at it later today/this weekend.  On sparc64 sizeof(int) is 4
> and sizeof(long) is 8 where on sparc (and the others) both sizeof(int)
> and sizeof(long) are 4.
> 
> Thanks in advance!
> 
> cheers
> 
> bruce
> 
> 
> -- 
> edoneel at sdf.lonestar.org
> SDF Public Access UNIX System - http://sdf.lonestar.org
> 
> 
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO September
> 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Ecls-list mailing list
> Ecls-list at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ecls-list

-- 
edoneel at sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org




More information about the ecl-devel mailing list