In Excel 2007/2010, I get this strange behaviour:

Formula in cell: =2.6+1.4+4.62-8.2
Result in cell: 0.420000000000002000

Weird extra '2' about 14DP in. Can anyone explain why this is happening please?


As mentioned in the comments, this is not a bug. It is due to the inevitable inaccuracy of floating point arithmetic due to the finite number of bits available to store values, resulting in an approximate representation which becomes apparent the more significant digits you choose to display.

Here are some useful articles for you:

  • IEEE floating point

  • Numeric precision in Microsoft Excel

  • Coding Horror - Why Do Computers Suck at Math?

  • How to correct rounding errors in floating-point arithmetic

  • Floating-point arithmetic may give inaccurate results in Excel

  • What Every Computer Scientist Should Know About Floating-Point Arithmetic

  • Understanding Floating Point Precision, aka “Why does Excel Give Me Seemingly Wrong Answers?” (Archived version with images)