O'Reilly logo
  • Nivan Morgan thinks this is interesting:

Because of rounding error, the difference between the approximations of .3 and .2 is not exactly the same as the difference between the approximations of .2 and .1. It is important to understand that this problem is not specific to JavaScript: it affects any programming language that uses binary floating-point numbers. Also, note that the values x and y in the code above are very close to each other and to the correct value.

From

Cover of JavaScript: The Definitive Guide, 6th Edition

Note

this must be a terrible confusing problem