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: count number of
Date: Wed, 30 Jul 2008 02:10:11 EDT
Organization: The Math Forum
Lines: 11
Message-ID: <2156845.1217398241891.JavaMail.jakarta@nitrogen.mathforum.org>
References: <g6oq99$dh6$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 1217398241 21239 144.118.30.135 (30 Jul 2008 06:10:41 GMT)
X-Complaints-To: news@support1.mathforum.org
NNTP-Posting-Date: Wed, 30 Jul 2008 06:10:41 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:482542



> d=17465765
> [crap,e]=log2(max(d));
> n=sum(rem(floor(d*pow2(1-max(1,e):0)),2));

quick question.

Why the max(d) in the log2 statement?  Isn't max(number) always just the number?

I took the max(d) out and it still seems to count ok.  Was there a good reason for it?

Thanks.