Path: news.mathworks.com!not-for-mail
From: "Andy Robb" <ajrobb@hotmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Even/odd
Date: Sat, 16 Aug 2008 01:42:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 9
Message-ID: <g85b99$sd1$1@fred.mathworks.com>
References: <fak6ev$t2k$1@fred.mathworks.com> <fak7e5$d6q$1@fred.mathworks.com> <fak8lr$34$1@fred.mathworks.com>
Reply-To: "Andy Robb" <ajrobb@hotmail.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1218850921 29089 172.30.248.37 (16 Aug 2008 01:42:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 16 Aug 2008 01:42:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1374918
Xref: news.mathworks.com comp.soft-sys.matlab:485779



> % a better way may be this
>      odd=bitand(abs(n),1);

Is the domain of bitand() limited to 32-bit integers? At
least mod(x,2) covers the range of whole numbers up to 53
bits. Sure, the returned matrix ought to be sparse, omitting
values where it is not certain if the number was even or odd
(e.g. either the fraction is not zero or the value is too
large to be odd).