Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
I've implemented this in Rust, and a Typescript implementation is on the way. You can find the repo here. I've called it SafeDecimal. I won't go in detail on the implementation, but let's compare it with the other usual approaches.
This issue (well, another one in a widely used JS library) is what brought me to dig deeper into these "arbitrary precision" libraries and understand why this happens. I thought they were using rational numbers, but that's not the case. And this is what led me to think about how to solve this problem.
Related posts
- BigDecimal equivalent. What do you use?
- Working with Currency Values in TypeScript
- Best way to deal with excessive decimal results in calculator
- How can i prove that 0.1 + 0.2 = 0.3 is there like a function or ANYTHING i can do to bypass this error which occurs in most programming languages
- Working with extremely large numbers?