What can I use as a decimal type in JavaScript? It's not supported (0.1 + 0.2 !== 0.3
), and I need it for representing exact values in a banking/financial application. See The State and Future of JavaScript for an good read and the dirty details behind JavaScript and its (lack of) support for decimal arithmetic.
By "decimal", I mean either:
- infinite-range and arbitrary-precision (like
BigDecimal
in Java), or - limited range and precision, but suitable for financial calculations (like
decimal
in C#).
So, what library or solution exists for working with decimal values? Thanks!