[ODE] dRandInt Crash Fix

Colin Bonstead colin at cyan.com
Wed Jun 22 08:32:15 MST 2005

Yup, we are using D3D and we're not setting the D3DCREATE_FPU_PRESERVE 
flag.  I thought we set it back to full precision in a few sections in 
the code, but now I can't find them.  Anyway, I know ODE wasn't getting 
it switched so I'm sure it was using 24 bit precision.  So yeah, I would 
much rather have an integer based rand.

-----Original Message-----
From: Adam D. Moss <adam at gimp.org>
Sent: Wed, 22 Jun 2005 11:50:09 +0100
To: ode <ODE at q12.org>
Subject: Re: [ODE] dRandInt Crash Fix

Adam D. Moss wrote:
> I think that what it intends to do is:
> int dRandInt (int n)
> {
>   double a = double(n-1) / 4294967296.0;

Forget that, it's kinda bogus.  However, it leaves your
strange problem unexplained.  Are you using D3D and letting
it lower the x87 internal accuracy?

Meanwhile I think I'm happier with the xor-folding int
implementation anyway...

Adam D. Moss   -   adam at gimp.org
ODE mailing list
ODE at q12.org

More information about the ODE mailing list