Search code examples
google-sheetsfloating-pointnumber-formattinggoogle-sheets-formula

8 displayed as 9 - strange visual glitch - cell formatted as fraction


The displayed value is different from the actual one. To reproduce enter:
=8+1/5-1/5

In any cell and then format it as # ?/?. To do that go to:

Format -> Number -> More Formats -> Custom number format

And choose # ?/?(or enter it in the textbox if it is not in the list).

Result:

enter image description here

(in B1 the formula is A1=8)

I could not find any other number than 8 (1-250) exposing such a strange behavior. I could not replicate same bug with constants like 7.9999999999 or 8.000000001.

Wrapping the formula with ROUND (=ROUND(8+1/5-1/5,307)) fixes the problem.

So this looks like a bug (where to report that?).

But the main question is: is there something special about this simple formula in floating point maths to confuse the interpreter?

PS: this bug cannot be reproduced in Excel 2013.


Solution

  • looks like it's rounded up, but like this it's correct:

    0

    you can report it like this:

    0

    enter image description here