Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: I don't even know what subject this lies under. Simple question:
Date: Sun, 28 Dec 2008 07:16:04 +0000 (UTC)
Organization: The MathWorks Inc
Lines: 29
Message-ID: <gj793k$t4p$1@fred.mathworks.com>
References: <gj77s6$hc9$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1230448564 29849 172.30.248.35 (28 Dec 2008 07:16:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 28 Dec 2008 07:16:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869871
Xref: news.mathworks.com comp.soft-sys.matlab:508944


"Kian " <kian.torab@utah.edu> wrote in message <gj77s6$hc9$1@fred.mathworks.com>...
> >> 9*0.0006 - 0.0054
> 
> ans =
> 
> -8.6736e-019
> 
> MathWorks is closed until Monday. It's driving me insane. Does anyone know what's going on? The answer should be 0.
> 
> This works:
> 
> K>> (0.0006 + 9*6/10000) - 0.006
> 
> ans =
> 
> 0
> 
> Any idea what's going on?

Read about floating point arithmetic:

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f2-12135.html#f2-98645
Especially,
http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f2-12135.html#bqxyrhp

Here's also some technical notes on the website:

http://www.mathworks.com/support/tech-notes/1100/1108.html