From: Blue Wizard <>
Newsgroups: comp.soft-sys.matlab
Subject: building regular floating point vectors
Date: Wed, 16 Jun 2010 09:29:04 -0700 (PDT)
Lines: 17
Message-ID: <>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: 1276705744 2334 (16 Jun 2010 16:29:04 GMT)
NNTP-Posting-Date: Wed, 16 Jun 2010 16:29:04 +0000 (UTC)
Injection-Info:; posting-host=; 
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; 
	Trident/4.0; GTB6.5; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 
	3.0.04506.30; .NET CLR 3.0.04506.648; InfoPath.2; .NET CLR 3.0.4506.2152; 
	.NET CLR 3.5.30729),gzip(gfe)
Xref: comp.soft-sys.matlab:645453

I wish to build a vector of increasing floating point number, all
separated by the same amount. I can do this either of the following
two ways:

delta is a floating point number, not necessarily whole
vec is a vector of floating point numbers, not necessarily whole
n is a floating point number but whole.

for the nth value

1)     vec(n)  = vec(n-1) + delta
2)     vec(n) = vec(1) + (n - 1) * delta

Question: The numbers delta and vec(1) might not be representable
exactly as binary numbers. Which method is more accurate in that
vec(n) is closest to the true value when the computation is performed
with floating point arithmetic. Thanks in advance.