4 ms·
I usually use cents as the stored amount, so no decimals. Is there something obviously wrong with this approach? Ie. if the price is 150.95 I store 15095 in th
by kisstheblade 8y ago
I usually use cents as the stored amount, so no decimals.
Is there something obviously wrong with this approach?
Ie. if the price is 150.95 I store 15095 in the db and do the calculations with cents, and then divide by 100 when presenting the values.
I have never come across fractional cents, maybe that is an issue in some scenarios (would be interested to know what those are... Even tax percentage calculations are rounded to the cent)