Skip to content

Rounding issue when summing tax amount #50

Description

@valii2334

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions