- October 28, 2015
- Posted by: Syed Shujaat
- Category: Uncategorized
In binary arithmetic, each bit within a group represents a power of two. Specifically, the first bit in a group represents 20 [Editor’s note for non-math majors: mathematicians stipulate that any number raised to the power of zero equals 1], the second bit represents 21, the third bit represents 22, and so on. It’s easy to understand binary because each successive bit in a group is exactly twice the value of the previous bit.
The following table represents the value for each bit in a byte (remember, a byte is 8 bits). In binary math, the values for the bits ascend from right to left, just as in the decimal system you’re accustomed to:
8th bit | 7th bit | 6th bit | 5th bit | 4th bit | 3rd bit | 2nd bit | 1st bit |
128 (27) | 64 (26) | 32 (25) | 16 (24) | 8 (23) | 4 (22) | 2 (21) | 1 (20) |
Now that we know how to calculate the value for each bit in a byte, creating large numbers in binary is simply a matter of turning on certain bits and then adding together the values of those bits. So what does an 8-bit binary number like 01101110 represent? The following table dissects this number. Remember, a computer uses 1 to signify “on” and 0 to signify “off”:
128 (27) | 64 (26) | 32 (25) | 16 (24) | 8 (23) | 4 (22) | 2 (21) | 1 (20) |
0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 |
In the table above, you can see that the bits with the values 64, 32, 8, 4 and 2 are all turned on. As mentioned before, calculating the value of a binary number means totaling all the values for the “on” bits. So for the binary value in the table, 01101110, we add together 64+32+8+4+2 to get the number 110. Binary arithmetic is pretty easy once you know what’s going on.
Leave a Reply
You must be logged in to post a comment.