3 ms·
Integer cents or an arbitrary precision decimal type.
by lordgilman 5y ago
Integer cents or an arbitrary precision decimal type.
- shagie 5y agoHaving worked on a POS system, the issue of using cents alone is if you've got something like "11% rebate" and you need to deal with fractional cents. The arbitrary precision decimal type should be the default answer for currency until it is shown that the requirements no and at no time in the future will ever require fractional units of the smallest denomination. As an aside, this may be constrained by the systems that the data is persisted into too... the Buffett Overflow is a real thing ( https://news.ycombinator.com/item?id=27044044 https://news.ycombinator.com/item?id=27044044 ).