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

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



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





Reply to: