This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I tried a couple of other Fortran compilers - and the result is:
Intel Fortran Compiler 11.1: NaN NaN NaN NaN NaN NaN (NaN,NaN) InfinityInfinity NaN NaN
and with Intel's icc (9.1): nan + nan i nan + nan i nan + nan i
Here is the C code:
#include <stdio.h> #include <complex.h>
int main() { complex double z1, z2, z3; z1 = 0.0; z2 = 1.0 + 2.0*I; z3 = (1.0 + 2.0*I)/0.0; printf("%f + %f i\n", __real__ (z3), __imag__ (z3)); printf("%f + %f i\n", __real__ (z2/z1), __imag__ (z2/z1)); z3 = z2/z1; printf("%f + %f i\n", __real__ (z3), __imag__ (z3)); }
And here the Fortran code:
Program test
complex(kind=8) z1, z2, z3;
z1 = 0.0
z2 = cmplx(1.0d0,2.0d0)
z3 = cmplx(1.0d0 + 2.0d0)/0.0d0;
print *, real(z3,kind=8),aimag(z3)
print *, real(z2/z1,kind=8),aimag(z2)
z3 = z2/z1;
print *, real(z3,kind=8),aimag(z3)
end program test
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |