Features

Off-By-One Error

By Dr. Lyndell St. Ville- ICT Consultant
By Dr. Lyndell St. Ville- ICT Consultant

COMPUTER programmers are expected to avoid making mistakes in their work. Of course, we know that does not always happen since words like “debugging” are used to describe part of the role of a programmer. Fortunately, many errors are obvious and are easily avoided because they prevent the programme from running. Other errors are more subtle, and the programme appears to run without an obvious problem, but may still introduce a serious weakness to the system being developed. Such mistakes may be made by both experienced and junior programmers. An example is the off-by-one error, which happens because the computer typically begins counting from the number zero, although we start counting from number one. That may not sound like much, but it is enough to cause much grief.

It can be frustrating that when we see the number zero, we should already be counting from one, so the number 5 actually represents a count of 6.

Armed with that information, you should now understand that the new “1-Off” game announced by the Saint Lucia National Lottery, where you choose a three digit number from 000 to 999, actually represents 1000 possible choices. The publicity surrounding the launch of that new game brought to mind this easily-made mistake that programmers make.

It is interesting that such a game was devised by the National Lottery which offers a greater chance of a successful match, with extra chances of winning still possible if the original number was not accurately guessed. It may even be tempting to try that game just to conduct an experiment on the numbers and possibilities. Beyond that simple review, I avoid making any claims about your reasons or chances of winning if you choose to play that game.

The off-by-one error is easier to understand within the context of the lottery, but for computer programmers, this subtle logic error may have serious consequences.

To share your views, contact the author at: www.datashore.net or via The VOICE.
About the Author
Dr.Lyndell St. Ville is an ICT Consultant based in Saint Lucia. His expertise includes systems analysis, design, and business intelligence.

Leave a Reply

Your email address will not be published. Required fields are marked *