

Decimal.js, arbitrary-precision decimal type for JavaScript - goblin89
https://github.com/MikeMcl/decimal.js

======
rpedela
This is great! Proper support for this has been lacking in the Node world. I
recommend json-bignum [1] if you need a Node library for JSON serialization
that can handle large numbers. For example, retrieving a JSON-formatted row
from Postgres which has int64 or numeric values. It is slower than the native
JSON functions though.

1\. [https://github.com/datalanche/json-
bignum](https://github.com/datalanche/json-bignum)

Disclaimer: I wrote json-bignum.

------
neals
Hoping somebody could explain to me why methods are written like so:

P['absoluteValue'] = P['abs'] = function () { }

instead of

P.absoluteValue = p.abs = function () {}

~~~
goblin89
Indeed. And, interestingly, Decimal.format (alone?) is declared with dot
notation[0]. Overall coding style feels relatively consistent so there must be
some reasoning behind these decisions.

[0]
[https://github.com/MikeMcl/decimal.js/blob/master/decimal.js...](https://github.com/MikeMcl/decimal.js/blob/master/decimal.js#L3957)

------
bigdubs
Reading the ReadMe.md makes me wish that javascript let you overload /
implement operators.

Type looks cool though

