Path: news.mathworks.com!not-for-mail
From: "Steve Amphlett" <Firstname.Lastname@Where-I-Work.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: What happened to so simple Matlab code?
Date: Wed, 21 Nov 2007 09:30:51 +0000 (UTC)
Organization: Ricardo UK Ltd
Lines: 36
Message-ID: <fi0tsb$d18$1@fred.mathworks.com>
References: <8220611.1195636303283.JavaMail.jakarta@nitrogen.mathforum.org> <fi0thf$9p1$1@fred.mathworks.com>
Reply-To: "Steve Amphlett" <Firstname.Lastname@Where-I-Work.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1195637451 13352 172.30.248.38 (21 Nov 2007 09:30:51 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 21 Nov 2007 09:30:51 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 43398
Xref: news.mathworks.com comp.soft-sys.matlab:438646



"Steve Amphlett" <Firstname.Lastname@Where-I-Work.com> 
wrote in message <fi0thf$9p1$1@fred.mathworks.com>...
> crammer008 <luochao2000@hotmail.com> wrote in message 
> 
<8220611.1195636303283.JavaMail.jakarta@nitrogen.mathforum.o
> rg>...
> > Dear all, I have the following code and the 
corresponding 
> results:
> > +++++++++++++++++++++++++++++++
> > >> aa = 0.005:0.01:0.025
> > aa =
> >     0.0050    0.0150    0.0250
> > >> daa = diff(aa)
> > daa =
> >     0.0100    0.0100
> > >> daa(1)-daa(2)
> > ans =
> >   1.7347e-018
> > ++++++++++++++++++++++++++++++++++
> > Obviously, we should have daa(1)-daa(2) = 0. Who can 
tell 
> me why Matlab can not give the correct result? Thanks!
> 
> 
> Check out the FAQ.
> 
> http://matlabwiki.mathworks.com/MATLAB_FAQ#Why_is_0.3-0.2-
> 0.1_not_equal_to_zero_.28or_similar.29.3F

The URL got chopped up.  Try this:


http://matlabwiki.mathworks.com/MATLAB_FAQ

Section 6.1