The following program gives "nan nan" output instead of expected "0 0"
#include <stdio.h>
_Complex double a, r;
double b = 1.0 / 0.0;
int
main (void)
{
__real__ a = 1.0;
__imag__ a = -1.0;
r = a / b;
printf ("%f %f\n", __real__ r, __imag__ r);
return 0;
}
As [EMAIL PROTECTED] pointed out
<<<<
Prof. W .Kahan mentions in his "Lecture Notes on the Status of IEEE
754" p.10
http://www.cs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF
"when (0+3i)/inf is turned naively into (0+3i)*(inf-i)/(inf^2+0^2) it
generates
a NaN instead of the expected 0."
>>>>
This may be of some relevance here.
--
Summary: double complex / inf gives nan instead of 0
Product: gcc
Version: 3.2.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dmitri at unm dot edu
CC: gcc-bugs at gcc dot gnu dot org,jakub at redhat dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19138