ODE Debug behaves differently than ODE release (was Re: [ODE] eliminating all state)

Pierre Terdiman p.terdiman at wanadoo.fr
Fri Nov 22 03:57:01 2002


> This is somewhat unsettling for me. I am reasonably certain that is is
> ODE itself which is behaving differently in debug and release modes,
> not my application. I don't have time to investigate this in detail
> now, but I wanted to add a second confirmation to Chris's: ODE debug
> behaves differently than ODE release.

Well, that's normal. Due to limited FPU precision,simply reordering some
operations can produce slightly different results (and reordering happens a
lot when the compiler optimizes the code, of course). Also, something like
this :

a = b / 2.0f;

...can be compiled with the divide in Debug mode, but actually be
transformed into :

a = b * 0.5f;

...in Release. Producing different results, that can add up quickly in a
physics engine.

You can try the following compiler option on VC++ :

Project Settings -> C/C++ -> Optimizations ->Improve float consistency

Sometimes it helps. But in some cases it can be very hard to get the exact
same behaviours in Debug & Release. There was a Gamasutra article explaining
related problems, when you try to record an animation and replay it in the
same exact way. That's surprisingly difficult.

Pierre