Comments
binary numbers are base-2 numbers
where as decimal numbers are base -10 numbers
Posted by blackmamba
binary numbers are base-2 numbers
where as decimal numbers are base -1 numbers
Posted by blackmamba
For details:
http://en.wikipedia.org/wiki/Decimal
http://en.wikipedia.org/wiki/Binary_numeral_system
Posted by sagitraz
Take the decimal number 176. Those three digits tell us that we have one 100, plus seven 10s, plus six 1s. Table illustrates how decimal numbers represent this distribution of values.
100,000s 10,000s 1000s 100s 10s 1s
0 0 0 1 7 6
To represent the decimal number 176 in binary, we need to figure out which columns (or bit positions) are "on" and which are "off." Now, because this is arithmetic, there are a few different ways to do this.
Start with the decimal number you want to convert:
176
Next, look at the values of each binary bit position and decide if you can subtract the highest column value and end up with a value of 0 or more. In this case, 176-128 = 48.
Yes, you can subtract 128 from 176 and get a positive value, 48. Because we "used" the 128 column, we put a 1 in that column, as shown in Table.
128 64 32 16 8 4 2 1
1
Now, we try to subtract the next highest column value from the remainder. We get 176 – 128 = 48. We take the 48 and subtract 64 from it.
Notice that you can't do this without getting a negative number; this is not allowed, so we can't use the 64 column. Therefore, we put a 0 in that column, as shown in Table.
128 64 32 16 8 4 2 1
1 0
Move along and do the math for the rest of the columns: 48 – 32 = 16. We then subtract 16 from 16 and get 0.
Note that when you get to 0, you are finished—you need to only fill the remaining bit positions with 0s to complete the 8-bit string. So, we used only the 128 column, the 32 column, and the 16 column. Table is what we end up with.
128 64 32 16 8 4 2 1
1 0 1 1 0 0 0 0
176 decimal = 10110000 binary.
If you add up 128+32+16, you get 176. That is how you convert from binary to decimal: Simply add up the column values where there is a 1.
Posted by sabastian