3 ms·
You don't have to quantize the unit price to the smallest coin, only the total final purchase amount. Gasoline is typically priced at $x.xx9/gallon, with the "u
by reaperman 3y ago
You don't have to quantize the unit price to the smallest coin, only the total final purchase amount. Gasoline is typically priced at $x.xx9/gallon, with the "unit" ending in 9/10th's of one penny, and this doesn't break anything, they just use bankers rounding before calculating the final payment amount.
Similarly, sales taxes often result in a fractional penny as well, which again gets floor() or bankers_rounding().