Re:Copilot regurgitating Quake code, including sweary comments
by lordgilman on Friday July 02, 2021 @09:37AM
(#27711351)
Integer cents or an arbitrary precision decimal type.
[ Parent
| on HN ]
Re:Copilot regurgitating Quake code, including sweary comments
by shagie on Friday July 02, 2021 @10:53AM
(#27712274)
Having 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 ).