[osg-users] division by zero in osgParticle/FluidProgram.cpp

Csaba Halász csaba.halasz at gmail.com
Thu Mar 12 11:01:55 PDT 2009


On Thu, Mar 12, 2009 at 6:03 PM, Robert Osfield
<robert.osfield at gmail.com> wrote:
> HI Csaba,
>
> I don't have any strong opinions on these issues, as I'm not very
> familiar with the code, and haven't seen problems first hand with the
> code segments your pointing out so don't have any extra insight to
> provide.  I don't know if you are directly seeing bugs, or just come
> across potential problems in a code review.

Yeah, division by zero causes SIGFPE if exceptions are enabled.
Otherwise it produces NaNs that aren't nice either :)

> As you're the first person to point to these potential problems I can
> only presume that you have a particular usage model that highlights
> them, this does place you in the best place to come up with a fix and
> qualify that they are fixed.  As Gordon mentioned, if you do come up
> with a fix post them to osg-submissions and then I can review them.

The problem is that I have no idea what this critical_dt means and I
am also not familiar with best practices in floating-point
calculations.
I am pretty sure checking for 0 will fix the divide by zero, but it
still leaves other bugs lurking. I just wanted to make sure the issue
is known and give a chance to any experts to come up with a proper
fix. I personally hate to fix things twice, if they could have been
fixed properly the first time around. But okay, I will submit the
0-check, then. Better than the current state, anyway.

-- 
Csaba



More information about the osg-users mailing list