This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/30789] complex folding inexact



------- Comment #7 from ghazi at gcc dot gnu dot org  2009-08-24 14:43 -------
Joseph - back in comment#2, you noted that the results of infinity and zero can
be ambiguous.  I.e. Infinity in either part of a complex number (perhaps
infinity of either sign?) is sufficient, and a pair of zeros, explicitly of
either sign is also sufficient for "zero".

This brings up the question that it's possible for GCC to produce a
compile-time result (via MPC) that is different from the runtime result (via
libgcc2) where both are C99 compliant standard conforming values.  Which one
the user receives would depend on the context (e.g. static init) or on whether
optimizations allowed GCC to fold it at compile-time.

Now this happens all the time for finite values, MPFR and MPC are more exact
that glibc's math library and often produce different results which are clearly
better.  However having GCC be more accurate than glibc (where the C library is
outside out control) is different IMHO than getting two entirely different
results from two parts of GCC, i.e. compile-time folding vs libgcc2.  E.g. (Inf
NaN) vs (0 -Inf) are both infinities per C99 Annex G.

While MPC has committed to producing C99 conforming results for the special
cases covered in Annex G, it is entirely possible they may come to different
conclusions as to what is best where the standard leaves things ambiguous.

Should I continue to pursue having GCC fold the Annex G special cases via MPC
if it leads to this kind of discrepancy?  Or should be seek to fold these
internally, essentially dulpicating the libgcc2 algorithm using real.c
functions so that both produce the same result?


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]