On Monday 02 October 2006 12:57, Joseph S. Myers wrote: > On Mon, 2 Oct 2006, Jan van Dijk wrote: > > * the C99 and C++ standards say *nothing* about the details of compex > > multiplication > > The C99 standard says that real operands aren't converted to complex, but > as I note in bug 24581, the compiler doesn't expect PLUS_EXPR and > MULT_EXPR to have arguments of different types, so the front ends might > need adapting to handle real * complex and real + complex specially.
Dear Joseph, My question was a slightly different one. To me it is not clear whether the standard allows the treatment of (r,0) as r in complex operations. For example: is it allowed to handle (r,0)*(x,y) as r*(x,y)? If this *is* the case, the special treatment of real*complex etc. that you suggested seems unnecessary: we merely have to teach the builtin multiplication routines to gracefully handle something like r*(Inf,0) by special handling of multiplications in which 0 is involved. lower_complex already has this effect (for -O1 and higher). If this is *not* the case, r*z may need to be handled separately by the front ends. But note that this implies that lower_complex and friends are off-specs. The 0*whatever-terms cannot be discarded, as is presently done. I repeat my previous mail: there does not seem to be consensus about what standard(s) to implement (Annex G? LIA-x,...), and how to interpret the free space in those documents. Could you clarify? > Patches welcome, see <http://gcc.gnu.org/contribute.html>. Triggered by 1*(Inf,0) = (Inf,NaN), I looked inside the compiler for the first time, yesterday. I am still leaning what a tree is. So that patch will not be rolled by me anytime soon, although I am eagerly learning gcc's internals. Thank you for your encouraging words, nevertheless :-) Regards, Jan.