Re: complex arithmetic in gcc (and various standards)

2006-10-03 Thread Jan van Dijk
On Monday 02 October 2006 20:53, Gabriel Dos Reis wrote: [...] > > | the result of the "same" multiplication considered as complex * > | complex (vs complex * real) has a different sign for the zero > | imaginary component. > > Thanks for the example. I'm not sure this was anticipated by the C++ >

Re: complex arithmetic in gcc (and various standards)

2006-10-03 Thread Jan van Dijk
On Tuesday 03 October 2006 11:08, Joseph S. Myers wrote: > On Tue, 3 Oct 2006, Jan van Dijk wrote: > > More serious is the fact that the compiler translates 1*(Inf,Inf) into > > (NaN,NaN). This is plain wrong, but, as Joseph mentioned, the solution > > requires the implementation of mixed-mode MULT

Re: complex arithmetic in gcc (and various standards)

2006-10-03 Thread Joseph S. Myers
On Tue, 3 Oct 2006, Jan van Dijk wrote: > More serious is the fact that the compiler translates 1*(Inf,Inf) into > (NaN,NaN). This is plain wrong, but, as Joseph mentioned, the solution > requires the implementation of mixed-mode MULT_EXPRESSIONS, since apparently > > 1*(Inf,Inf) == (Inf

Re: complex arithmetic in gcc (and various standards)

2006-10-03 Thread Jan van Dijk
On Monday 02 October 2006 19:39, Gabriel Dos Reis wrote: > "Joseph S. Myers" <[EMAIL PROTECTED]> writes: > | On Mon, 2 Oct 2006, Jan van Dijk wrote: > | > On Monday 02 October 2006 12:57, Joseph S. Myers wrote: > | > > On Mon, 2 Oct 2006, Jan van Dijk wrote: [...] > | > Triggered by 1*(Inf,0) = (In

Re: complex arithmetic in gcc (and various standards)

2006-10-02 Thread Joseph S. Myers
On Mon, 2 Oct 2006, Paolo Carlini wrote: > I'm not sure if the following is exactly Joseph' point, but I'd like to know > your opinion about it anyway: if you look to Comment #19 in the audit trail of > PR 28408, I noticed that, due to the rule about signed zero (with default > rounding): > (

Re: complex arithmetic in gcc (and various standards)

2006-10-02 Thread Gabriel Dos Reis
Paolo Carlini <[EMAIL PROTECTED]> writes: | Hi Gaby | | > | > 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)? | > | | I d

Re: complex arithmetic in gcc (and various standards)

2006-10-02 Thread Paolo Carlini
Hi Gaby | > 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)? | | I don't think so; at least, it might affect negative 0. Hmm, how

Re: complex arithmetic in gcc (and various standards)

2006-10-02 Thread Gabriel Dos Reis
"Joseph S. Myers" <[EMAIL PROTECTED]> writes: | On Mon, 2 Oct 2006, Jan van Dijk wrote: | | > 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

Re: complex arithmetic in gcc (and various standards)

2006-10-02 Thread Joseph S. Myers
On Mon, 2 Oct 2006, Jan van Dijk wrote: > 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 co

Re: complex arithmetic in gcc (and various standards)

2006-10-02 Thread Jan van Dijk
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

Re: complex arithmetic in gcc (and various standards)

2006-10-02 Thread Joseph S. Myers
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 argume

Re: complex arithmetic in gcc (and various standards)

2006-10-02 Thread Paolo Carlini
Hi Jan, Hello, I was recently bitten by gcc's handling of complex multiplication. My program is in C++, but since std::complex uses C99's complex types, my questions below apply to C as well. I only want to say more explicitely that apparently both C and C++ are affected, and in *i

complex arithmetic in gcc (and various standards)

2006-10-02 Thread Jan van Dijk
Hello, I was recently bitten by gcc's handling of complex multiplication. My program is in C++, but since std::complex uses C99's complex types, my questions below apply to C as well. In my program, I have r*c, where r is an fp type and c a complex. In my calculation I sometimes encoun