Alex Rivera | Logout

JavaScript: Decimal Values

Asked 2010-08-11T02:58:23.237
27

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 a good read and the dirty details behind JavaScript and it's (lack of) support for decimal arithmetic.

By "decimal", I mean either:

  1. infinite-range and arbitrary-precision (like BigDecimal in Java), or
  2. 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!

Edit
Report

1 Answer

3

Take a look at BigNumber and that post too.

answered 2010-08-11T03:03:55.973

Your Answer