Path: news.mathworks.com!newsfeed-00.mathworks.com!NNTP.WPI.EDU!elk.ncren.net!newsflash.concordia.ca!canopus.cc.umanitoba.ca!not-for-mail
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Newsgroups: comp.soft-sys.matlab
Subject: Re: Even/odd
Date: Tue, 19 Feb 2008 22:52:37 +0000 (UTC)
Organization: National Research Council Canada - Conseil national de rechereches Canada
Lines: 21
Message-ID: <fpfmjl$2fg$1@canopus.cc.umanitoba.ca>
References: <fak6ev$t2k$1@fred.mathworks.com> <fpfhha$86m$1@fred.mathworks.com>
NNTP-Posting-Host: origin.ibd.nrc.ca
X-Trace: canopus.cc.umanitoba.ca 1203461557 2544 192.70.172.160 (19 Feb 2008 22:52:37 GMT)
X-Complaints-To: abuse@cc.umanitoba.ca
NNTP-Posting-Date: Tue, 19 Feb 2008 22:52:37 +0000 (UTC)
Originator: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Xref: news.mathworks.com comp.soft-sys.matlab:452526



In article <fpfhha$86m$1@fred.mathworks.com>,
Amber York <yorksea@gmail.com> wrote:
>How about 

>function [ise] = iseven(x);
>%works for sccalar and vector
>ise = roundn(x/2,0) == x/2;

roundn is only in the Mapping toolbox.

Please check the function for a full range of input,
such as  iseven([-inf -2 -1 0 1 1.49 1.5 1.51 1.99 2 inf nan])

I do not have roundn to check with, but I suspect you will
find that your iseven function will tell you that -inf and inf
are even.

-- 
Q: Why did the chicken cross the Mobius strip?

A: There were manifold reasons.