The tax amount is calculated here.
However, each tax amount should be rounded before summing them, rather than rounding only after the total is calculated. Otherwise, we can end up with different results.
For example, given the tax amounts 2084.5622 and 805.18409:
- Without rounding first: 2084.5622 + 805.18409 = 2889.74629 → rounded to two decimals = 2889.75
- With rounding first: 2084.56 + 805.18 = 2889.74
This means the current implementation can produce totals that differ from the sum of the individually rounded tax amounts.
The tax amount is calculated here.
However, each tax amount should be rounded before summing them, rather than rounding only after the total is calculated. Otherwise, we can end up with different results.
For example, given the tax amounts 2084.5622 and 805.18409:
This means the current implementation can produce totals that differ from the sum of the individually rounded tax amounts.