Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Very simple number equation does not equate.
Date: Sun, 5 Jul 2009 15:59:02 +0000 (UTC)
Organization: Universit&#228;tsSpital Z&#252;rich
Lines: 35
Message-ID: <h2qik6$6q8$1@fred.mathworks.com>
References: <h2qav3$7um$1@reader01.singnet.com.sg>
Reply-To: <HIDDEN>
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 1246809542 6984 172.30.248.37 (5 Jul 2009 15:59:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 5 Jul 2009 15:59:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 11
Xref: news.mathworks.com comp.soft-sys.matlab:552896


"sun" <sun@gmail.com> wrote in message <h2qav3$7um$1@reader01.singnet.com.sg>...
> Dear matlab gurus,
> 
> I encountered a very puzzling problem. 0.2+0.2+0.2+0.15+0.05 clearly adds up
> to 0.8. But on matlab R2007b, it does not equate. Why? I have been tearing
> my hair apart as this problem looks so simple and yet elusive. Could some
> matlab guru enlighten a newbie like me?
> 
> Below are what appears on my matlab screen;
> 
> >> 0.2+0.2+0.2+0.15+0.05==0.8
> 
> ans =
> 
>      0
> 
> >> 0.2+0.2+0.2+0.14+0.06==0.8
> 
> ans =
> 
>      1
> 
> 
> >> 0.2+0.2+0.2+0.2==0.8
> 
> ans =
> 
>      1
> 

a hint:

http://matlabwiki.mathworks.com/MATLAB_FAQ#Why_is_0.3-0.2-0.1_not_equal_to_zero_.28or_similar.29.3F

us