Rounding is complex because different currencies use different numbers of decimal places.
The following methods return a value with the correct number of decimals, which is determined by the input currency.
Currency.Round()
Currency.Percentage()
Money.Round()
Do not use Math.Round() for rounding. For example, do _not_ use the following code.
If you currently use Math.Round, replace it like this.
## Calculate and round an order total
After rounding, use the rounded value for all further totals. For example, here is the correct way to add a number.
## Calculate taxes
To get an order‘s correctly-rounded tax amount, do not use the tax amount of individual items. Instead, follow this example.
In the above code, saleTaxesAmount is returned with a rounded value.
Note
Do not use billingCurrency.Percentage(itemPriceWithoutTax, x.Percentage) in other situations