News for hackers. Stuff that matters.
Re:Copilot regurgitating Quake code, including sweary comments by thayne on Friday July 02, 2021 @11:08AM (#27712487)
An integer of the smallest denomination. For example, cents for the American dollar. And you probably would want to wrap it in a custom type to simplify displaying it properly, and maybe handle different currencies. If you language has a fixed point type that might also be appropriate, but that's pretty rare, and wouldn't work for currencies that aren't decimal (like the old british pound system).
Re:Copilot regurgitating Quake code, including sweary comments by biztos on Friday July 02, 2021 @11:18AM (#27712641)
Do they still use fractional cents (or whatever) in finance?

https://money.howstuffworks.com/personal-finance/financial-p...

Re:Copilot regurgitating Quake code, including sweary comments by TchoBeer on Friday July 02, 2021 @11:57AM (#27713159)
What if I'm calculating sales tax? Can't use an integer anymore.
Re:Copilot regurgitating Quake code, including sweary comments by kyllo on Friday July 02, 2021 @12:53PM (#27713943)
Yes, you can. There are algorithms for rounding up, rounding down, rounding to nearest, and banker's rounding, on the results of integer division. This is a solved problem.