This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/24581] Complex arithmetic on special cases is incorrect.
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Oct 2005 20:09:45 -0000
- Subject: [Bug c/24581] Complex arithmetic on special cases is incorrect.
- References: <bug-24581-10110@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from joseph at codesourcery dot com 2005-10-29 20:09 -------
Subject: Re: New: Complex arithmetic on special cases is
incorrect.
On Sat, 29 Oct 2005, kargl at gcc dot gnu dot org wrote:
> * underflow, sign and efficiency bugs by rewriting I*y as
> * (0.0+I)*(y+0.0*I) and laboriously computing the full complex product.
Note that the correct form is (0.0+I)*y, since I is (per C99+TC1+TC2)
_Complex_I, of complex type (Annex G imaginary types conflicting with the
normative standard, unless and until anything changes in this respect
following DR#323). But the usual arithmetic conversions as specified in
the standard do not convert both operands to complex, so one can be real
and one complex.
I suspect there are lots of presumptions in the compiler that arithmetic
operations such as PLUS_EXPR and MULT_EXPR have both operands of the same
type, which would need to be fixed to represent a real*complex product
properly.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24581