js-big-decimal
Basenumber.js
js-big-decimal | Basenumber.js | |
---|---|---|
2 | 1 | |
134 | 7 | |
- | - | |
5.9 | 0.0 | |
27 days ago | about 2 years ago | |
TypeScript | JavaScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
js-big-decimal
-
Numeric from DB to string.
So yeah, there's no zero effort drop-in replacement. If you really really need all that precision (which I doubt), I'd recommend using something like js-big-decimal to handle the heavy lifting.
-
Algebra in Javascript
(Consider using https://github.com/royNiladri/js-big-decimal if you care about accuracy. JavaScript isnβt great at some floating point calculations https://modernweb.com/what-every-javascript-developer-should-know-about-floating-points/ )
Basenumber.js
-
0.1 + 0.2 is not 0.3 in JavaScript.
That's because every number in JavaScript is represented using 64 bits floating point. Since numbers are saved in binary, there are some decimal numbers that are periodics in binary but not in decimal, e.g. 0.2, equivalent to 0.00110011001100110011... in bin. You can avoid this using some BigDecimals libraries like decimal.js, or, if you need to work in different bases, you have Basenumber.js
What are some alternatives?
Angular - Deliver web apps with confidence π
dock-spawn-ts - A TypeScript HTML Docking Framework (fork of dock-spawn)
TypeScript - TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
jsbi-calculator - JSBI-Calculator is an IE11-compatible calculator utility to perform arbitrary (up to 18 decimals) arithmetic computation, with the help of JSBI-based BigDecimal.
ts-8-bit - Using TypeScript's Type System to do 8-bit Arithmetic
number-precision - π1K tiny & fast lib for doing addition, subtraction, multiplication and division operations precisely
mintable - π Automate your personal finances β for free, with no ads, and no data collection.
Arrayality - Tiny puzzle which gives you freedom
money.ts - A TypeScript/JavaScript library to make working with monetary values easier and safer.