proposal-decimal
proposal-decimal copied to clipboard
Document more about challenges in the current ecosystem
The README asserts that not having a decimal type causes problems for JavaScript programmers. Have you faced these problems? If we could document them with the proposal, or link to references, it would be very helpful.
Yes, I've had plenty of issues. It seems no-one manages to cover all edge cases when handling money without bigdecimals. Here's a list of issues I've opened over the years:
https://github.com/ikr/money-math/issues/28 https://github.com/dinerojs/dinero.js/issues/7 https://github.com/dinerojs/dinero.js/issues/8 (closed, but not fixed I think) https://github.com/davidkalosi/js-money/issues/32 https://github.com/ikr/money-math/issues/34
Also: https://github.com/openexchangerates/accounting.js/issues/222
Some try to use integers, but in addition to the issues noted in this proposal:
- Without bigints you'll have a hard time with crypto currencies that have many decimals
- Currency exchange often use decimals, and you can't just multiply an integer number of cents with a decimal and get the correct solution