This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug fortran/40318] Complex division by zero in gfortran returns wrong results



------- Comment #1 from kargl at gcc dot gnu dot org  2009-06-01 06:54 -------
(In reply to comment #0)
> Complex division by zero in gfortran returns NaN.  This is expected for 0/0,
> but other finite/zero should return Inf.  This impacts the testcase
> gfortran.dg/real_const_3.f90 in two values incorrectly computed:
> 
>   complex :: z = (-0.1,-2.2)/(0.0,0.0)
>   complex :: z2 = (0.1,1)/0
> 
> See: http://gcc.gnu.org/ml/fortran/2009-05/msg00423.html
> 
> This should be fixed in gcc-4.5 by using MPC for division, but older versions
> of GCC should add special case handling in the fortran frontend simplification
> code.
> 

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


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40318


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]