About diagonal matrices

Daniel J Sebald daniel.sebald at ieee.org
Sun Mar 1 16:05:05 CST 2009


Jaroslav Hajek wrote:
> On Sun, Feb 22, 2009 at 12:49 AM, Daniel J Sebald

>>Here's a bug:
>>
>>octave:18> complex(0,Inf) - Inf
>>ans = -Inf + Infi
>>octave:23> complex(0,-Inf) + Inf
>>ans = Inf - Infi
>>
>>That should be -Inf + NaNi, I'd think.
> 
> 
> Why?

Eh, that looks right.  I must have gotten lost in looking at all the Inf scenarios.

> 
> 
>>Same sort of thing here:
>>
>>octave:28> complex(0,-Inf) / 0
>>warning: division by zero
>>ans = NaN - NaNi
>>
>>should be NaN - Infi.
>>
> 
> 
> Not really. The reason is that the zero is converted to complex zero
> prior to the division, i.e. there is no actual complex/real operation
> implemented in Octave. An implementation using the direct algorithm
> would, of course, be superior.

OK, complex(3,4)/complex(0,0) = NaN + NaNi.  I guess it is better as is.  In some sense, there shouldn't be a NaN + NaNi, just NaN, otherwise there is all kind of implied meaning.  Same with Inf + Infi.  (Just exactly along what path does the limit follow?)

Alright, so:

octave:24> complex(3,0) / 0
warning: division by zero
ans = NaN - NaNi
octave:25> 3 / 0
warning: division by zero
ans = Inf

Anyone recall John Travolta when he started out in Welcome Back Kotter?  "I'm so confuuuuused".

Dan


More information about the Octave-maintainers mailing list