Open HaKr opened 2 years ago
But this is a rounding error, isn't it? It's present even in the most sophisticated accounting applications. The operations otherwise seems correct to me. Even the last one. 33,33 * 3 = 99,99 no matter the currency. This is happening because money has fixed precision and dividing 100 by 3 creates an approximate value using rounding to the money's minor units.
When handling monetary amounts, the precision should be that of the minor unit instead of mathematical correct fractions. Current implementation seems to maintain the mathematical fraction