Our great sponsors
-
eslint-plugin-big-number-rules
Enforce (or automatically fix) finance-safe calculations using BigNumber or similar libraries.
-
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.
Either avoid floating-point, perhaps using BigInt, or use a library like BigNumber.js. (Incidentally, I wrote an eslint plugin to enforce its use.)
Either avoid floating-point, perhaps using BigInt, or use a library like BigNumber.js. (Incidentally, I wrote an eslint plugin to enforce its use.)
There's a BigDecimal TC39 proposal to bring this kind of thing to the native language, but until then you have to choose between accuracy and performance.
Related posts
- eslint-plugin-big-number-rules: Enforce finance-safe calculations (helps 0.1 + 0.2 really equal 0.3)
- Floats Are Weird
- Decoding Why 0.6 + 0.3 = 0.8999999999999999 in JS and How to Solve?
- Front-End Dilemmas: Tackling Precision Problems in JavaScript with Decimal.js
- Rant - Javascript should be able to do simple f**king math by now