Decimal to Binary - Alternate method
Decimal to Binary[edit]
The normal method when converting from Decimal to Binary is often time consuming. Take a look at the following table from W1011, which converts 53410 to binary.
Step | Dividend | Divisor | Quotient | Remainder |
---|---|---|---|---|
1 | 534 | 2 | 267 | 0 |
2 | 267 | 2 | 133 | 1 |
3 | 133 | 2 | 66 | 1 |
4 | 66 | 2 | 33 | 0 |
5 | 33 | 2 | 16 | 1 |
6 | 16 | 2 | 8 | 0 |
7 | 8 | 2 | 4 | 0 |
8 | 4 | 2 | 2 | 0 |
9 | 2 | 2 | 1 | 0 |
10 | 1 | 2 | 0 | 1 |
This common method took ten steps, however there is a method which takes fewer steps. In order to use this method, we need to know the value of each binary digit that is less than the number we are converting. Reference the following table:
Binary Digit | Value in Decimal |
---|---|
0001 | 1 |
0010 | 2 |
0100 | 4 |
1000 | 8 |
0001 0000 | 16 |
0010 0000 | 32 |
0100 0000 | 64 |
1000 0000 | 128 |
0001 0000 0000 | 256 |
0010 0000 0000 | 512 |
... | ... |
Let's take a look at converting 53410 again, but using a new method. First, find the largest Decimal number in the above table compared to the number that is being converted. Second, subtract that number from the number that is being converted. Last, add the binary digit to the final number. Repeat this until the remaining number is zero. This is somewhat confusing, so take a look at the example table below.
Step | Converting Number | Subtracted Number | New Number | Binary Number |
---|---|---|---|---|
1 | 534 | 512 | 22 | 0010 0000 0000 |
2 | 22 | 16 | 6 | 0010 0100 0000 |
3 | 6 | 4 | 2 | 0010 0100 0100 |
4 | 2 | 2 | 0 | 0010 0100 0110 |
This method only took four steps for this number. This is much better when compared to the previous method that took ten steps. A short example video may help with grasping this concept:
A short video will be added soon, check back in later.
The number of steps in this method is determined by the number of binary digits in the number. For example, 9610 is equal to 0110 00002 and thus would take two steps. However, 25510 is equal to 1111 11112 and would take eight steps, which would make the number of steps equal to the dividing method shown in W1011.