This is discussed in more detail in
Bug? 1+1 != 2. See in particular the replies from
BrowserUk. The short answer is that this is just a consequence of using floating point arithmetic, and there are a number of ways around it depending on what you want to do.