Decimal to binary conversion
In this article, I will describe one of the easiest methods for converting decimal numbers to binary. It is especially useful when there are multiple numbers to convert.
Make a list of all the powers of 2, starting with 2 up to the number you want to convert. Please note that this is an inclusive range. So if the number is a power of two, it must be included in the list. Make sure to write the list in descending order. For example, if the number is 73; 64 is the largest power of two which is not larger than 73. So the list must contain the numbers 64, 32, 16, 8, 4, 2, and 1. You could think of the elements in this list as the column headings of a table; please refer to the image below. Let us look at the steps needed to convert 73 to binary.
- Find the largest power-of-two which is not larger than 73. We already did that to determine how many powers of two we need in our list. We found this to be 64. Place a 1 below 64 on the list.
- Subtract the power of two from the number; 73 – 64 = 9.
- Repeat the first step, this time with 9 as the number. The largest power-of-two which is not larger than 9 is 8. Place a 1 below 8 in the list.
- Repeat step two with the new numbers; 9 – 8 =1.
- Repeat the first step, this time with 1 as the number. This time the power of two we want is the same as the number. Place a 1 below 1 in the list.
- Repeat the second step; 1 – 1 = 0. When we reach zero we can stop.
- Place zeros below all the other powers of two in our list. That are the ones under which we have not placed a 1.
- The row below the powers-of-two list is the answer.
This method has the disadvantage that we need to prepare a list of powers of two first. But we can treat elements of this list like the column headings of a table. This allows us to convert multiple numbers using a single list.