Path: news.mathworks.com!newsfeed-00.mathworks.com!nlpi057.nbdc.sbc.com!prodigy.net!news.glorb.com!news.aset.psu.edu!support1.mathforum.org!not-for-mail
From: bogfrog <jmcgraw@rcn.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: if else - odd -even in Matlab
Date: Tue, 12 Aug 2008 15:59:47 EDT
Organization: The Math Forum
Lines: 13
Message-ID: <26607091.1218571217942.JavaMail.jakarta@nitrogen.mathforum.org>
References: <g7slut$cgv$1@fred.mathworks.com>
NNTP-Posting-Host: nitrogen.mathforum.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: support1.mathforum.org 1218571217 5895 144.118.30.135 (12 Aug 2008 20:00:17 GMT)
X-Complaints-To: news@support1.mathforum.org
NNTP-Posting-Date: Tue, 12 Aug 2008 20:00:17 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:485137


> I've always used
>    if floor(number)==number, %then even
>    else                      % odd
>    end


What?  How can that possibly work?

floor(5)==5

is true.  So is 5 even?

As for not using mod()...  I still don't really see the big deal.  Why would you test for even/odd on non-integers anyway?