MATLAB: 0.1+0.2-0.3=

arithmeticfaq6.1floating point equal

Hello,
Apologies if I'm doing something stupid, but could someone please explain why 0.1+0.2-0.3 apparently equals 5.5511e-017?
If this is confirmed, I find it quite worrying, so are there other such "features" that may be quietly affecting my results without me being aware of them?
Many thanks, Jon.

Best Answer

stupid, no; common, yes.
In fact this is the most frequently asked question on here and CSSM.