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

2005-08-10 Thread John Houck
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,

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

2005-08-10 Thread Petr Salinger
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 -- To UNSUBSCRIBE, email t