Rounding is a tricky topic. All systems have their own approaches, so it's impossible for things to match perfectly across systems (1st party, 3rd party, POS, etc.). Tax calculations will occasionally be off by a cent or two when comparing 1st party vs. POS, for instance.

Rounding differences result from the following decisions:

**Where does rounding occur?**Should we round at the order level, item level, or modifier level? Applying tax at each level, rounding at each level, and then summing the result will often be $0.01 or $0.02 different than just taking the order subtotal, applying tax, and rounding there. This is just math.**How many decimal places should we round to?**Should we round to 4 decimal places at the item or modifier level and 2 only at the order level, or 2 decimal places everywhere? Again, this will impact the final total because...math.**Which rounding technique should we use?**Round half up, round half down, round half even, round half odd, etc. Lots of different ways to round things per this "Math Is Fun" article:__Rounding Methods__.

At Direct Ordering, we calculate tax wherever there's a price, so it happens at the item level and the modifier for each type of tax involved. We do this because tax rates can be different for different items and because certain items or modifiers could have more than one tax.

We round to 4 decimal places at the item and modifier level and 2 everywhere else (surcharges, etc.). We use the round half even approach because it avoids __the round toward positive infinity bias of a simple round up approach__. We then sum up all of these individual tax contributions and use round half even to round to 2 decimal places at the order level.

We do this because we believe it's the most accurate approach, but unfortunately it doesn't always match up with other systems.

## Comments

0 comments

Please sign in to leave a comment.