Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!news2.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe15.iad.POSTED!7564ea0f!not-for-mail
From: "Nasser M. Abbasi" <nma@12000.org>
Newsgroups: comp.soft-sys.matlab
References: <hcfjrm$jcs$1@fred.mathworks.com>
Subject: Re: i <= 0 ??
Lines: 36
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3598
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350
X-EsetId: 321EA926BF203339645A
X-EsetScannerBuild: 5941
Message-ID: <s1JGm.37806$Tx1.13127@newsfe15.iad>
NNTP-Posting-Host: ncdeodfefpjopplmihjclpliaacepnnh
X-Complaints-To: abuse@charter.net
X-Trace: ibafepnipngekpdoadefjppgkgeilljaebffhijadmncilcjncdeodfefpjopplmmgdmmdanmgdmojgmdjlbfdkbeinfhoncoeggmpchongebilpmbhodcpgkmlhadkcfjldooimgccmanmp
NNTP-Posting-Date: Fri, 30 Oct 2009 21:38:32 UTC
Date: Fri, 30 Oct 2009 16:38:30 -0500
Xref: news.mathworks.com comp.soft-sys.matlab:581422



"Muhammad " <muhali@shaw.ca> wrote in message 
news:hcfjrm$jcs$1@fred.mathworks.com...
> Complex number are ordered in matlab. For the imaginary unit, i, for 
> example, I get
> ? disp(i < 0 | i == 0)
> ans =
>     0
> This may be consistent behavior. But it is certainly inconsistent with the 
> following result:
> ? disp (i <= 0)
> ans =
>     1

Ordering where complex numbers are involved should be based on the real 
parts. If 2 complex numbers have the same real part, then the imaginary part 
(its absolute value) should break the tie.

In the first example,   i<0 , here since real part of i which is 0 is NOT 
less than zero then i<0 is false.  For i==0, since the real parts are equal 
(both are zero) then we look at the imaginary part to break the tie. Since 
the abs value of the imaginary part of i (which is 1) is clearly not equal 
to the imaginary part of zero, which is zero, then we get False again. 
Hence the result false Or False is False as shown.

For the case of i<=0, the real part of i is zero, and the real part of 0 is 
zero, so it is a tie, looking at the imaginary parts, the absolute value of 
the imaginary part of i is 1, and the for 0 it is zero, hence 1<=0 should be 
False.

Hence Matlab answer for i<=0  should be 0 not 1. This is a bug. Or Matlab 
uses some other logic to decide on these issues.

--Nasser