The mystery of gross pay and nett pay
I have never really understood the Inland Revenue’s tax bands. As a mathematician, I would have made sure that every threshold was a multiple of 156, so that it could be divided by 12 (months) and 52 (weeks). That way, you could pay yourself the same gross amount each month, and the nett amount would be the same. But no, the nett amount keeps varying for the same gross amount. I use my own software to keep our accounts, and tweak the gross amount so that the nett amount comes to the same each month. This is a matter of trial and error, and is always a little tedious.
I wanted a way to enter the desired nett amount, and for it to calculate the gross amount. Looking at the way the two are related, I knew it would not be easy to just work backwards. I therefore decided on a successive approximation approach. It all works well. I now enter the nett amount required. It uses this as a gross amount, and calculates what the nett amount would be. The result will clearly be less than expected, so I add the difference between the required and the calculated nett amounts, and use that as the new gross amount. I do the same thing again, and the calculated nett amount will be nearer to what I want, but not quite there yet, so I add the new difference to the gross amount, and try again.
I perform this iteration as many times as necessary, in order to calculate the correct gross amount. Having written the code, I thought I had better check to see how many attempts it made to calculate various nett amounts. Admittedly, the testing was not exhaustive, but I have not yet found an amount that requires more than seven passes round the loop. Job done! Every time I use it, it makes me happy when I consider what is going on behind the scenes.