» npm install decimal.js
As their author, I recommend bignumber.js or big.js, 'a small, fast Javascript library for arbitrary-precision arithmetic with decimal numbers'.
For a more mature library, the ICU4J BigDecimal translation is also recommended.
There's been a "port" of the Java BigDecimal class (I think it's here: http://freshmeat.net/projects/js_bigdecimal/ ) for a long time. I looked at it a long time ago and it seemed kind-of cumbersome and huge, but (if that's the one I'm thinking of) it's been used as part of some cryptography tools so there's a decent chance that it works OK.
Because cryptography is a likely area to generate a need for such things, that's a good way to snoop around for such packages.
edit: Thanks @Daniel (comment to question) for this older SO question: https://stackoverflow.com/questions/744099/javascript-bigdecimal-library
Hey Node Friends. I'm going to have to build a system that deals with currency and money arithmetic for the first time. We are all aware that using floating points is problematic for these sort of calculations.
Is there a preferred library by the community that deals with this stuff?
The best I've found on my own is big.js
Update: Unlike the comments below, I didn't use float or integers as that is what I was trying not to use in the first place.
mathjs was a suggestion, but that depends on decimal.js anyway so you could just use decimal.js directly.
I read over this comparison between decimal.js, big.js and bignumber.js. I went with big.js in the end, just because it's the more minimal version of the 3 that does everything I need (ex. I only need to use base 10)
Thanks for the help!