------- Comment #2 from joseph at codesourcery dot com  2009-07-26 17:32 -------
Subject: Re:  complex folding inexact

The example in this bug deals with excess overflow for division.  For 
infinities computing as NaN + iNaN, an example is (NaN + iInf) * (NaN 
+iInf) (where NaN +iInf is obtained as (__builtin_inf () * (0.0 + 1.0i))) 
- this works if computed at runtime but not constant folded.  ("Works" 
here means that at least one part of the result is an infinity - I do not 
believe there is a specific requirement beyond that.)

For division producing NaN + iNaN, (1.0 + 0.0i) / (0.0 + 0.0i) should 
produce an infinity, (__builtin_inf () * (0.0 + 1.0i)) / (1.0 + 0.0i) 
should produce an infinity, (1.0 + 0.0i) / (__builtin_inf () * (0.0 + 
1.0i)) should produce a zero (in which each part may have either sign).

All the above can usefully be tested for both constant folding and runtime 
evaluation.

There are also cases for exact rounding where you'd expect MPC to produce 
the right results but would *not* expect operations executed at runtime to 
produce exactly those results.  For example, (1.0 + DBL_EPSILON + 1.0i) * 
(1.0 - DBL_EPSILON + 1.0i), which would only work at runtime if the code 
happens to use exactly the right fused multiply-add operation.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30789

Reply via email to