[PATCH]: Integrate gfortran with MPC

Tim Prince TimothyPrince@sbcglobal.net
Fri May 29 21:09:00 GMT 2009


Tobias Burnus wrote:
>
> 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
>
>
>   

These tests might not make sense with Intel compilers without setting an 
option such as '-fp-model precise'
I'll try it when I find a power cord for my laptop

>
> 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
>   



More information about the Gcc-patches mailing list