16

Apparently, floating point math is broken.

=SUM((2.1 - 2.0) - 0.1)

In PHP and Haskell this also happens

Comments
  • 2
    @SanitizedOutput I want to bet some companies had to learn that the hard way.
  • 3
    @SanitizedOutput Eyyyy
  • 13
    LibreOffice.. Nothing fancy.
  • 4
    It all depends on if the calculation uses IEEE float/double or datatype designed for accurate decimal.

    IEEE is much faster but cannot handle some decimal numbers like 0.1.

    In most cases it can conclude what it should be and round it to a sane number but if you do some calculations it no longer fits the requirements for rounding
  • 4
    @imerljak Some people actually know how to produce proper software. Unlike certain companies...
  • 0
    @irene But still at my company this was news for a mathematician who is not too much into writing software.
  • 0
    Float is a expression.

    It is not a concrete value.

    Expression - depending on the precision / mantisse.

    ...

    So yes. This is exactly what you should expect.
  • 2
    Yep. Floating point math is broken. Don't use it if close enough isn't good enough. This is why I get annoyed at languages that don't have an int type and people who think that's not an issue.

    Here's a great video about it: https://youtu.be/PZRI1IfStY0
  • 1
    @M3m35terJ05h Tom scott is best
  • 1
    @Matt-Smeets Preach. I wish he'd come back and do some more computerphile
Add Comment