IEEE floating point has a special zero value. See
http://stevehollasch.com/cgindex/coding/ieeefloat.html in the "Special
Values" section. You can compare against this value, and (a - a) =
0.0f. You do lose that precision when you introduce multiplication
and division...so you might end up with ((b * a) / b - a) != 0...which
is why everyone warns against comparing with zero. Nevertheless, 5.0f
/ 0.0f will still trigger a divide by zero error, and that can be
avoided by checking the denominator against 0 (which is what this
patch does).
On Apr 11, 2005 1:06 PM, Marcus Meissner <[EMAIL PROTECTED]> wrote:
> On Mon, Apr 11, 2005 at 12:47:22PM -0700, Daniel Remenak wrote:
> > Changelog:
> > Return DISP_E_DIVBYZERO instead of crashing when asked to divide a
> > variant by zero.
>
> You cannot really compare floats against 0 I think.
>
> Ciao, Marcus
>
>