4 ms·
In the case of currency, it is better to use decimal arithmetic because if you use float numbers the rounding behaves different than doing the same operations b
by huherto 16y ago
In the case of currency, it is better to use decimal arithmetic because if you use float numbers the rounding behaves different than doing the same operations by hand or in a calculator. Another option is to use integers (to represent number of cents) and just print the decimal point when displaying the number.
- euroclydon 16y agoI'm not sure if you're answering my question or not. I've inspected the source of both libraries, and they both use the JS method toFixed().
- huherto 16y agoNever mind, you are right it is just to format decimals.