Probably thebest way to think about how a power of two value is expressed in binary is
that a one turns on a particular value, and the zero turns it off. For example, the binary
number 101 represents the decimal value 5. Here’s why:
(1 2^2 ) + (0 2^1 ) + (1 * 2^0 ) = 5
In this example, one times two to the second power plus one times two to the zero power
adds up to the decimal number five.
Each numeral in the number represents a power of two, which gets bigger by one
(starting from 0) moving to the left. However, if you tried inserting our decimal example
of4,321intothebinarynumber,itwon’tbeadirectfit.Rememberthatbinaryhasonlythe
numerals0and1tousetoexpresshowmanyofaparticularpoweroftwovalueisincluded
in the value. In this case, you would need to substitute the actual values to represent this
decimal number. Table 2-1 lists the first eight powers of two.
Converting Decimal to Binary
To convert the decimal number 221 to binary, power of two values are subtracted from
the number and a one is placed in the power of two position for that value. Like this:
- The largest power of two value that is not greater than 221 is 128 (the next
power of two value is 2^8 or 256): 221 – 128 = 93. The binary number at this
point is 10000000, which represents the decimal value 128. - The largest power of two value that is not greater than 93 is 64 (see Table 2-1):
93 – 64 = 29. The binary number is now 11000000, which represents the decimal
value of 192 (128 + 64). - The largest binary value that is not greater than 29 is 16 or 2^4 : 29 – 16 = 13.
The binary number is now 11010000. Remember that we did not use the
25 (32) position. - The largest binary value that is less than 13 is 8 or 2^3 : 13 – 8 = 5. The binary
number at this point is 11011000, which represents the decimal value of 216
(128 + 64 + 16 + 8). - To complete the conversion, turn on the binary values for 4 and 1, which
results in the binary number 11011101, which represents the decimal value
of 221 (128 + 64 + 16 + 8 + 4 + 1).
If you’re thinking that the number 11011101 would take more space in the computer to
store than the number 221, remember that the computer can only store the binary values
of 1 and 0. It can’t store, work with, manipulate, add, or use any value not expressed as a
binary number. There just isn’t any way to store a 2, a 4, or a 9 in a single bit.
Chapter 2: Basic PC Concepts and Terminology^29