News for hackers. Stuff that matters.
Re:Your balance is $0.30000000004 by davedx on Tuesday February 18, 2020 @11:43AM (#22357316)
> In the end these conversion errors are not solvable in any language

Not true at all.

Ruby has BigDecimal: https://ruby-doc.org/stdlib-2.5.1/libdoc/bigdecimal/rdoc/Big...

.NET also has a Decimal type.

I've worked on salary calculation applications and e-commerce platforms, and found that language choice makes a big difference.

Re:Your balance is $0.30000000004 by raxxorrax on Tuesday February 18, 2020 @01:57PM (#22359035)
With insolvable i meant just the technical restrictions of floating point numbers. There are of course solutions. But there is just the fact that binary numbers with discrete length can only be mapped to so many numbers.

If you use numbers directly in exponential form in vanilla javascript, you already get better results.

Re:Your balance is $0.30000000004 by mark-r on Tuesday February 18, 2020 @11:46AM (#22357347)
It's not that they're not solvable, it's just that you have to go out of your way to use the proper type or library. The default floating point type still has problems.
Re:Your balance is $0.30000000004 by daxelrod on Tuesday February 18, 2020 @12:47PM (#22358142)
Important caveat: BigDecimal is arbitrary-precision, not infinite-precision. Using it still requires you to think about the precision of each number you operate on.