On 01/28/2013 05:29 PM, Tuomo Keskitalo wrote:
On 01/27/2013 05:47 PM, Andreas Schwab wrote:

The ode-initval2 test no longer fails, but others remain.

Hmm. I removed part of code which divided and multiplied a set of values by the same constant (doing stuff in between). Rhys said earlier:

> FWIW, I am aware of FMA gives the wrong answer for comparisons like
> (a*x + b*y) == 0 when x == y and b == -a.  The fix is never check
> strict equality for floats and instead check if |a*x + b*y| < tol.
> The problem in those cases is not the use of FMAs but rather the code
> being incorrect in the presence of floating point arithmetic.

So, does this mean that whenever an algorithm relies on a=a+a-a or a=a*a/a, the algorithm is going to fail when high precision is required? I don't know details about sf, poly or cfd functions, but there might be a few problematic places.

I wonder if you should post separate bug reports against those, this one was for ode-initval2 only.

Sorry, meant a=a+b-b and a=a*b/b.

No. You need both addition and multiplication to involve FusedMultiplyAdd. No FMA will take place in a==a*b/b. It might fail or not, that depends on specific numbers and rounding mode. Unless I missed some new floating point instructions or new quirks of compiler optimization.

Reply via email to