# Decimal Number Adding Algorithm For Software Testers

Back to school! Here we will explain decimal numbers adding algorithm, but tailored for software testers. The post is aligned with the Black Box Software Testing Foundations course (BBST) designed by Rebecca Fiedler, Cem Kaner, and James Bach.

The above picture shows the basic decimal addition algorithm for decimal numbers with precision of three boxes. You simply add ones, tens, and hundreds, and you are done.

The fun starts when the addition result (e.g. for single-digit) is greater than ten. This is overflow, and we teach children in school:

You need to take that one and put it in the next box on the left.

If you are a software tester, software under test is running on some kind of computer. Fun with math is that it introduces infinity. Math is abstract so you probably hear the definition of the line:

A line is a straight one-dimensional figure having no thickness and extending infinitely in both directions.

No thickness and infinity extend!? Have to be honest, that blew up my mind in third grade. How can something have no thickness?

In the overflow picture, in case of overflow, you just draw an additional box on the left. If there is no room on paper (Epistula non erubescit), you just start over and make a room.

But the computer is a different kind of beast. There is no computer with an infinitive amount of memory. Memory is divided into blocks, and every block has a limit. In the overflow picture above, the memory block limit for decimal numbers is one. So the result of adding five and seven is two, not twelve! And this is an overflow error. Because in one box of decimal digits, we can store numbers zero to nine.

Fun fact. The following picture shows electricity consumption meter, produced in Yugoslavia:

Note five boxes: red is for 1/10, and others are ones, tens, hundreds and thousands. This is an old meter, and it overflows from 9999 to 0000. Consumption of the average household is 2500 kWh per year. Counters were checked every three months. Meter is set to zero. So if the family managed to do an overflow, consumption of 10000 kWh, the counter starts from zero again. In the last century’s sixties, it was hard to do overflow, but in the nineties, it was much more manageable. And as there was no investment in power meters with five boxes, many households (I am talking about Croatia, of course) managed to do overflow and get free electric power!

Originally published at on November 4, 2019.

Written by