Re:0.30000000000000004
by hrktb on Monday December 02, 2019 @04:49PM
(#21687378)
The basic representation is usually good enough at 2 decimals (so a plain int), but it is often needed to have a transient representation during calculations.
For instance if one needs to apply discounts, add taxes, split in equal parts, all of the above one after the other, there will be a more precise intermediary representation before rounding everything in a way that keeps the total amount consistent with the original amount.
For instance if one needs to apply discounts, add taxes, split in equal parts, all of the above one after the other, there will be a more precise intermediary representation before rounding everything in a way that keeps the total amount consistent with the original amount.