views:

194

answers:

1

Is there a mature library for doing decimal-based math, possibly arbitrary-precision, in JavaScript?

Edit: I want this information for a reference page on floating-point-related problems and alternatives to use when binary floating-point is inappropriate: http://floating-point-gui.de/

+4  A: 

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: http://stackoverflow.com/questions/744099/javascript-bigdecimal-library

Pointy
The official homepage of the BigDecimal port seems to be this: http://stz-ida.de/html/oss/js_bigdecimal.html.en - I couldn't even find a way to download it from freshmeat.
Michael Borgwardt
Ah. Well it shows up all over the place in google searches. It's been around for a long time.
Pointy
spoulson