|
From: | Michael Goffioul |
Subject: | Re: Sparse matrix problem |
Date: | Wed, 03 Jan 2007 22:27:45 +0100 |
User-agent: | Thunderbird 1.5.0.9 (Windows/20061207) |
With g++ 4.1.2 on my system, it prints (nan,nan). That seems like a bug to me, but maybe it is standard conforming (and if it is, wtf?!?)? If it is a bug, then the bug should be fixed in the compiler, not Octave.
[snip]
so maybe we need a better than grammar school implementation here.
The problem also exists in MSVC (altough (1+i)/0 gives good result, (1+i)/(0+0i) does not). In the end, the fundamental problem is in the complex division implementation:
x/y is converted into x*y'/|y|^2 if y = 0+0i x*y' => 0+0i (whatever x) |y|^2 => 0 hence x/y => NaN+NaNi (whatever x)However, the complex division is only valid if y is non-zero. In the MSVC complex header, one can see that the result of x/y when y = 0+0i is explicitely set to NaN+NaNi, it's even
not the result of a computation like 0/0 (like in the gcc headers). Michael.
[Prev in Thread] | Current Thread | [Next in Thread] |