From bug-request at octave dot org Mon Feb 7 09:45:10 2005 Subject: Re: Inconsistency in complex division by zero From: "John W. Eaton" To: bug at octave dot org Date: Mon, 7 Feb 2005 10:49:41 -0500 On 7-Feb-2005, Gabriele Pannocchia wrote: | Hi | | Matlab 7.0sp1 returns to me: | >> 1i/0 | Warning: Divide by zero. | | ans = | | NaN + Infi | | i.e. with a "+" for the imaginary part. | | Since 1/0 returns (either in octave and matlab) | >> 1/0 | Warning: Divide by zero. | | ans = | | Inf | | I think the correct answer should be : | ans = NaN + Infi And I would say both are wrong, because i is pure imaginary, so we should really be getting just Infi, no? When we have 1/0, we get Inf, not Inf+NaNi (i.e., there is no imaginary part of 0 that is magically tacked on to the 1 to screw things up). Another example that demonstrates this problem is Inf*i, which you would expect to produce Infi, not Nan+Infi. To solve this correctly, we need a pure imaginary data type or perhaps special cases in many of the operators in the complex class. jwe ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------