The Numeric Systems: 
Remember that the maximum decimal number you can store in a byte is 255. Once you have a decimal number, you can use the remainder operation to fill out the bits. Let's convert the number 206. Considering 206, since this is greater than 128, fill out bit 7 with 1. This produces:
Next, find the remainder of 206 by 128: As you can see, the remainder of dividing 206 by 128 is 78. Therefore, fill out the corresponding bit of 64, which is bit 6, with 1:
Next, find the remainder of 78 by 64. This produces 14. 14 is less than 32. Therefore, the bit corresponding to decimal 32, which is bit 5, has a binary value of 0. 14 is less than 16. Therefore, bit 4 is 0. 14 is greater than 8. Therefore, fill out bit 3 with 1:
Now, find the remainder of 14 by 8. This is 6. 6 is greater than 4. Therefore, bit 2 has a binary value of 1.
Find the remainder of 6 by 4. This is 2. According to this, bit 1 will have a binary value of 1. The remaining decimal value is 0. Therefore, bit 0 has a value of 0. The decimal number 206 produces the following table:

Converting any Number From Decimal to Binary 
Converting a decimal number to binary takes longer because of the various comparisons you would perform. There are, as always, various techniques available. Once again, find the range of the number using numbers such as those: 
2^{n1}  2^{30}  2^{29}  2^{28}  2^{27}  2^{26}  2^{25}  2^{24} 
etc  1,073,741,824  536,870,912  268,435,456  134,217,728  67,108,864  33,554,432  16,777,216 
2^{23}  2^{22}  2^{21}  2^{20}  2^{19}  2^{18}  2^{17}  2^{16} 
8,388,608  4,194,304  2,097,152  1,048,576  524,288  262,144  131,072  65,536 
2^{15}  2^{14}  2^{13}  2^{12}  2^{11}  2^{10}  2^{9}  2^{8} 
32,768  16,384  8,192  4,096  2,048  1,024  512  256 
2^{7}  2^{6}  2^{5}  2^{4}  2^{3}  2^{2}  2^{1}  2^{0} 
128  64  32  16  8  4  2  1 
Imagine you would like to convert the following decimal number 408340623 = 408,340,623 to binary (I picked this number completely randomly). 408,340,623 is less than 536,870,912 but is greater than 268,435,456. Therefore, we will start the counting at 268,435,456. Write 1 under 268,435,456. 
536,870,912  268,435,456  134,217,728  67,108,864  33,554,432  16,777,216  
0  1 
At this time, we have the number as 1. Next, find the remainder (you can use a calculator) of 408,340,623 by 268,435,456, which is 139,905,167. 139,905,167 is greater than 134,217,728. Therefore, write 1 under 134,217,728 
536,870,912  268,435,456  134,217,728  67,108,864  33,554,432  16,777,216  
0  1  1 
The current number is 11000 or 1 1000 
536,870,912  268,435,456  134,217,728  67,108,864  33,554,432  16,777,216  
0  1  1  0  0  0 
8,388,608  4,194,304  2,097,152  1,048,576  524,288  262,144  131,072  65,536 
0 
Since 4,194,304 is immediately less than 5,687,439 fill it with 1
536,870,912  268,435,456  134,217,728  67,108,864  33,554,432  16,777,216  
0  1  1  0  0  0 
8,388,608  4,194,304  2,097,152  1,048,576  524,288  262,144  131,072  65,536 
0  1 
The number becomes 1100001 or 110 0001. Then find the remainder of 5,687,439 by 4,194,304. This produces 1,493,135. This number is greater than 1,048,576. Therefore, write 0 under 2,097,152 and 1 under 1,048,576. 
536,870,912  268,435,456  134,217,728  67,108,864  33,554,432  16,777,216  
0  1  1  0  0  0 
8,388,608  4,194,304  2,097,152  1,048,576  524,288  262,144  131,072  65,536 
0  1  0  1 
Now the number is 110000101 or 1 1000 0101 
536,870,912  268,435,456  134,217,728  67,108,864  33,554,432  16,777,216  
0  1  1  0  0  0 
8,388,608  4,194,304  2,097,152  1,048,576  524,288  262,144  131,072  65,536 
0  1  0  1  0  1 
The number has become 11000010101 or 110 0001 0101 
536,870,912  268,435,456  134,217,728  67,108,864  33,554,432  16,777,216  
0  1  1  0  0  0 
8,388,608  4,194,304  2,097,152  1,048,576  524,288  262,144  131,072  65,536 
0  1  0  1  0  1  1 
The current number is 110000101011 or 1100 0010 1011 
536,870,912  268,435,456  134,217,728  67,108,864  33,554,432  16,777,216  
0  1  1  0  0  0 
8,388,608  4,194,304  2,097,152  1,048,576  524,288  262,144  131,072  65,536 
0  1  0  1  0  1  1  0 
32,768  16,384  8,192  4,096  2,048  1,024  512  256 
1 
The current number is 11000010101101 or 11 0000 1010 1101 
536,870,912  268,435,456  134,217,728  67,108,864  33,554,432  16,777,216  
0  1  1  0  0  0 
8,388,608  4,194,304  2,097,152  1,048,576  524,288  262,144  131,072  65,536 
0  1  0  1  0  1  1  0 
32,768  16,384  8,192  4,096  2,048  1,024  512  256 
1  1 
The number becomes 110000101011011 or 110 0001 0101 1011 
536,870,912  268,435,456  134,217,728  67,108,864  33,554,432  16,777,216  
0  1  1  0  0  0 
8,388,608  4,194,304  2,097,152  1,048,576  524,288  262,144  131,072  65,536 
0  1  0  1  0  1  1  0 
32,768  16,384  8,192  4,096  2,048  1,024  512  256 
1  1  0  0  1 
The number becomes 110000101011011001 or 11 0000 1010 1101 1001 
536,870,912  268,435,456  134,217,728  67,108,864  33,554,432  16,777,216  
0  1  1  0  0  0 
8,388,608  4,194,304  2,097,152  1,048,576  524,288  262,144  131,072  65,536 
0  1  0  1  0  1  1  0 
32,768  16,384  8,192  4,096  2,048  1,024  512  256 
1  1  0  0  1  0  0  0 
128  64  32  16  8  4  2  1 
1 
The current number is 1100001010110110010001 or 11 0000 1010 1101 1001 0001 
536,870,912  268,435,456  134,217,728  67,108,864  33,554,432  16,777,216  
0  1  1  0  0  0 
8,388,608  4,194,304  2,097,152  1,048,576  524,288  262,144  131,072  65,536 
0  1  0  1  0  1  1  0 
32,768  16,384  8,192  4,096  2,048  1,024  512  256 
1  1  0  0  1  0  0  0 
128  64  32  16  8  4  2  1 
1  0  0  0  1 
The current number is: 11000010101101100100010001 or 11 0000 1010 1101 1001 0001 0001 The remainder of 15 by 8 is 7, which is greater than 4. Fill out bit 2 with 1. 
536,870,912  268,435,456  134,217,728  67,108,864  33,554,432  16,777,216  
0  1  1  0  0  0 
8,388,608  4,194,304  2,097,152  1,048,576  524,288  262,144  131,072  65,536 
0  1  0  1  0  1  1  0 
32,768  16,384  8,192  4,096  2,048  1,024  512  256 
1  1  0  0  1  0  0  0 
128  64  32  16  8  4  2  1 
1  0  0  0  1  1 
The current number is: 110000101011011001000100011 or 110 0001 0101 1011 0010 0010 0011 The remainder of 7 by 4 is 3, which is greater than 2. This produces: 
536,870,912  268,435,456  134,217,728  67,108,864  33,554,432  16,777,216  
0  1  1  0  0  0 
8,388,608  4,194,304  2,097,152  1,048,576  524,288  262,144  131,072  65,536 
0  1  0  1  0  1  1  0 
32,768  16,384  8,192  4,096  2,048  1,024  512  256 
1  1  0  0  1  0  0  0 
128  64  32  16  8  4  2  1 
1  0  0  0  1  1  1 
The current number is: 
536,870,912  268,435,456  134,217,728  67,108,864  33,554,432  16,777,216  
0  1  1  0  0  0 
8,388,608  4,194,304  2,097,152  1,048,576  524,288  262,144  131,072  65,536 
0  1  0  1  0  1  1  0 
32,768  16,384  8,192  4,096  2,048  1,024  512  256 
1  1  0  0  1  0  0  0 
128  64  32  16  8  4  2  1 
1  0  0  0  1  1  1  1 
The final number is: The equivalent decimal number of 408340623 in binary is 11000010101101100100010001111 or 1 1000 0101 0110 1100 1000 1000 1111 
Practical Learning: Converting a Number From Decimal to Binary 

Previous  Copyright © 20032008 FunctionX, Inc.  Next 
