[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#322218: more robust code (gcc -O2 optimization bug)



On Wed, Aug 10, 2005 at 09:47 +0200, Petr Salinger wrote:
> Hi,
> 
> in floating point code is better to avoid testing with equality.
> In your example, you should change 
> 
> if (fa == 0.0)
> if (fb == 0.0)
> 
> into:
> 
> if (fabs(fa) < DBL_EPSILON)
> if (fabs(fb) < DBL_EPSILON)
> 
> After that, it works with gcc -O2.
> 
> Regards 
> 		Petr
> 

In retrospect, I should have known better, but for some reason
I didn't see the problem.

Thanks,
-John




Reply to: