Rounding
Rounding in business documents may seem straightforward at first glance, but it can be deceptively complex. The rules governing rounding are subject to interpretation, leading to variations in algorithms and results across different companies, services, and applications.
From getpaid, we invest considerable effort in minimizing rounding errors, focusing on some crucial areas, such as, general number rounding, generating totals and calculating Taxes.
General number rounding
General rounding refers to the mathematical process of adjusting numerical values to a specified level of precision or a particular place value. The purpose of general rounding is to simplify numbers for ease of interpretation, communication, or calculation. In general rounding, a number is modified to a nearby value that is easier to work with or more relevant in a given context.
The most common method of general rounding involves determining whether the digit in the next smaller place value is 5 or greater. If it is, the digit being rounded is increased by one; if not, the digit remains unchanged. This process is applied consistently across various numerical values, such as whole numbers, decimals, or percentages.
For example:
3.6751
results3.68
.3.6750
results3.68
.3.6749
results3.67
.
Generating totals
An invoice comprises various line amounts and references to elements like payments and advances, getpaid ensures that calculations adhere to the currency's base precision plus an additional 2 decimal places. Returned calculated amounts are expressed in the currency minor unit.
To illustrate, when dealing with currencies like Euros (EUR) or Sterling (GBP), the ultimate precision for calculations would be set at 4. However, for currencies like the Japanese Yen (YEN), which do not involve cents, only 2 decimal places would be added.
When displaying totals, getpaid consistently employs rounding based on the default precision of the currency. This practice is crucial because the majority of tax agencies do not acknowledge precision levels that exceed the granularity of the local coinage. However, an unforeseen consequence of this approach is that, on occasion, the presented numbers may not align perfectly and could deviate by a few cents.
Calculating taxes
When calculating taxes on an invoice, there are various options for determining how taxes are applied to different elements such as lines, groups, totals, or items before taking into a account quantity or adjustments.
getpaid calculates taxes on total, this is the best way to reduce the potential for rounding errors. This method is recommended by the EN 16931 as it gives the greatest precision. However, taxes are also estimated on a line-by-line basis in the invoice documents enhacing the understanding of tax distribution. In practice, as long as calculations are performed with increased precision, the distinction between using the line or total methods is minimal.
Some countries may require the tax to be calculated on a line-by-line basis, if this is the case, contact our customer success team to discuss your requirements.