Hacker News new | past | comments | ask | show | jobs | submit login

Very cool! I've run into some of these kinds of issues myself in my daily work and it took a long time to both discover the other and a solution. I'll definitely try this out to see if it can help me find and fix these kinds of issues faster.



Where do you work? Not many people run into fp accuracy issues.


Well, chances are if you think you don't, you already do.

There is a reason a big part of numerics (the mathematical disciplíne) is about dealing with it.


Most people don't realize they have them. For instance in most BI/ETL tools the expression below returns false:

    0.1 + 0.2 = 0.3
In Excel and Google Sheets, this returns false:

   2.03 - 0.03 - 2 = 0


In both of those cases the problem is not problem with floating point arithmetic but the parsing of floating point literals, or rather how systems take input and then substitute it with something different quietly behind the scenes. None of 0.1, 0.2, 0.3 are true (binary) fp values. Nobody would be surprised that

    0.1000000000000000056 + 0.2000000000000000111 != 0.2999999999999999889


You won't believe it, but Excel users are actually surprised. As do users of many other applications.


Somebody pointed me at "Towards an API for the Real Numbers" which explains why these calculations work how you expect in the Android default Calculator.

It's really nice, as they explain you can't drop this in instead of the floating point arithmetic in a serious language because the performance isn't what you want. However in human terms, for a product like the calculator - it's easily fine.


That's a very different kind of accuracy, though.

This tool is about improving the number of digits that are correct.

Trying to use exact equality is going to fail on most equations even if you have millions of correct digits.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: