Ólafur Páll Geirsson

Launaskil: payroll managment for independent contractors

01 Sep 2014.

We just launched Launaskil, a payroll managment system for independent contractors in Iceland. I developed a large part of the website, everything from the back end web app, managing the production servers, setting up SSL certificates as well writing as a couple of client-side widgets. In the project we made a neat use of the classic binary search algorithm.

Our payroll calculator allows you to calculate wage-related expenses in Iceland. With the calculator you can calculate payroll from different kinds of income: your salary before tax has been applied (ísl. laun), what your income is after tax (ísl. útgreidd laun) or the total amount you can pay for salary (ísl. heildarkostnaður).

The issue with calculating all expenses from the second two inputs (útgreidd laun and heildarkostnaður) is that I didn’t want to reimplement most of the logic I had done for the first input (different settings for pension funds, personal discount and more). Instead, when the user inputs, say, his desired income after tax. We binary search for a salary that gives us that income after tax. Given that the search space is in the order of up to 10 million, the search will take at most 24 iterations.

This worked out great, I encourage you to give it a try!

About: web development, taxes, binary search