------- Comment #2 from ghazi at gcc dot gnu dot org 2009-06-01 08:35 ------- (In reply to comment #1) > Kaveh, > After looking into the problem, I think (nan + i nan) is > an acceptable result for z = (-0.1,-2.2)/(0.0,0.0) > because of the standard definition of complex division. > For z2 = (0.1,1)/0, I think that you are correct, and > gfortran should give (inf + i inf).
Why is one different than the other? I don't know fortan promotion rules, but in C, the latter case promotes to (0.1,1.0)/(0.0,0.0) which looks very much like the first case. Does fortran handle type promotion differently? Regardless, I don't know that any "standard definition" of complex division applies here. The canonical algebraic formula is undefined mathematically in the presence of division by zero. So at least in C there are rules telling us what to do, and they say return Inf. Does fortran follow a standard here we can compare against or are we guessing? :-) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40318