News for hackers. Stuff that matters.
Re:Your balance is $0.30000000004 by moftz on Tuesday February 18, 2020 @11:04AM (#22356986)
Unless I have to actually work with floats, I try to only do everything with int math to keep things sane. Not to mention, that it usually makes calculations faster.
Re:Your balance is $0.30000000004 by Aardwolf on Tuesday February 18, 2020 @11:10AM (#22357036)
Decimal floating point exists (https://en.wikipedia.org/wiki/Decimal64_floating-point_forma...), is that considered useable for financial data, or does it turn out in practice to also suffer from the same issues? Since, e.g., dividing through 3 will not be exact here either of course.
Re:Your balance is $0.30000000004 by HideousKojima on Tuesday February 18, 2020 @11:23AM (#22357123)
It doesn't have the same issues (at least from my experience in C#) but it runs quite a bit slower than normal floats and doubles:

http://csharphelper.com/blog/2017/05/compare-the-performance...