An explanation on AutoCount GST rounding algorithm

Home » GST » An explanation on AutoCount GST rounding algorithm
GST No Comments

Hi, if you have seen two lines with same amount, but GST amount may be different by 1 cent in AutoCount Accounting. Don’t worry, this is correct as it is caused by the adaptive rounding algorithm used by AutoCount Accounting. Let me explain in detail how this algorithm works in the following paragraph.

Let see the following example:

Line No Qty Unit Price Tax % GST (Unrounded) GST (Rounded)
1 1 13.11 6% 0.7866 0.79
2 1 13.11 6% 0.7866 0.79
3 1 13.11 6% 0.7866 0.79
4 1 0.00 6% 0.0000 0.00
Total 3 39.33 2.37

 

If you calculate the GST line by line and do the rounding to 2 decimal, then the total GST of the above Invoice is 2.37, however, if you use 39.33 x 6% = 2.3598 ~= 2.36, which has 1 cent different. Since most of the time, users would use total amount x 6% to calculate their GST, so we have to resolve this potential 1 cent different issue.

In order to resolve this issue, you can apply this 1 cent to the last row of the invoice, then it will become the below example:

Line No Qty Unit Price Tax % GST (Unrounded) GST (Rounded)
1 1 13.11 6% 0.7866 0.79
2 1 13.11 6% 0.7866 0.79
3 1 13.11 6% 0.7866 0.79
4 1 0.00 6% 0.0000 -0.01
Total 3 39.33 2.36

 

Then the weird thing is user might ask why the last line (Line No. 4), the unit price is 0.00, but why GST is -0.01.

Then in order to resolve this 1 cent issue, we have derived a rounding algorithm called Adaptive Rounding Algorithm.

The algorithm works from top to bottom.

Line No Qty Unit Price Tax % GST (Unrounded) Prev Unrounded Total Prev Rounded Total GST (Rounded)
1 1 13.11 6% 0.7866 0.7866 0.79 0.79
2 1 13.11 6% 0.7866 1.5732 1.57 0.78
3 1 13.11 6% 0.7866 2.3598 2.36 0.79
4 1 0.00 6% 0.0000 2.3598 2.36 0.00
Total 3 39.33 2.36

 

The GST of line 1 is just the rounded value of 0.7866, which is 0.79.

The GST of line 2 is Round(0.7866 + 0.7866) – [line 1 GST] = Round(1.5732) – 0.79 = 1.57 – 0.79 = 0.78.

The GST of line 3 is Round(0.7866 + 0.7866 + 0.7866) – [line 1 GST + line 2 GST] = Round(2.3598) – 1.57 = 2.36 – 1.57 = 0.79.

The GST of line 4 is Round(0.7866 + 0.7866 + 0.7866 + 0.0000) – [line 1 GST + line 2 GST + line 3 GST] = Round(2.3598) – 2.36 = 2.36 – 2.36 = 0.00.

The formula is:

Round(Sum of unrounded GST from line 1 to line n) – Sum(GST from line 1 to line n-1)

By using this rounding algorithm, line 4 will not have any GST because the unit price is 0.00, however, it may make the intermediate line has weird GST value such as line 2, which has GST value of 0.78, different from 0.79 of line 1 and line 3.

But because in the end, people tends to check GST of the whole invoice instead of individual item, so we have applied this algorithm in our calculation. In other words, as long as the total GST is correct, then users don’t worry too much about the individual GST amount.

Note: This algorithm has been accepted by Singapore Iras for many years.