[Cfp-interest 1480] Re: complex multiplication and division

Damian McGuckin damianm at esi.com.au
Mon Feb 10 16:31:27 PST 2020


That really wild answer seen in your division is a compiler bug and should 
be reported as such. I more rigorously reran your examples and I also get 
the incorrect 1.17... with -O0 on both 4.8.5 and 9.2.1 on a XEON but the 
correct numbers for -O1 and above. Also, on 4.4.7 on a XEON, it gets it 
wrong at any level of optimization. It seems like it is a compiler bug 
that was half fixed. Note that I do not see this problem on a Power9 with 
gcc 9.1.1 running CentOS 8. It gets it right at any level of optimization. 
I do apologize that I misreported that gcc version earlier as 9.2.1. I 
blame my dyslexic fingers. I note also that

 	double complex x = 1.0e+200 + INFINITY * I;
 	double complex y = INFINITY * I;

both produce NaN + INFINITY * I. So the problems are more fundamental.

Remember too that the description of this group is "IEC 60559 Floating 
point support in C". As complex arithmetic is not covered in IEC 60559 
(IEEE 754), it is out of scope for the CFP, even if it is of interest to 
many of us.  Just a thought.

Regards - Damian


More information about the Cfp-interest mailing list