• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Binary math question

Fistandantilis

Senior member
I am a bit confused here and need a little push,

1111 = 15
1111 1111 = 255
1111 1111 1111 = 2815? OR 270

the first set of bits goes to a highest value of 15, the first and second set goes to 255. now I am lost at what does the third set make, does the rightmost bit position equat to 1, 0 or does it go to 256
I know this is a bit confusing and I have searched my textbook and the sets of bits they give are all done in sets of 8, I am working with a set of 12, please any help would be greatly appreciated
 
Four bits actually give you sixteen discrete values, because they can all be 0.

2^4 = 16 (range 0 .. 15)

Eight bits give you 256 discrete values.

2^8 = 256 (range 0 .. 255)

Twelve bits give you 4096 discrete values.

2^12 = 4096 (range 0 .. 4095)

Sixteen bits give you 65536 discrete values.

2^16 = 65536 (range 0 .. 65535)

Thirty-two bits give you 4294967296 discrete values.

2^32 = 4294967296 (range 0 .. 4294967295)

And so on.
 
Easiest way to do it, IMO, is write the number value for each placeholder above the number. Then, you multiply what the value is (1 or 0) by the placeholder value. Example:

16 8 4 2 1
1 0 1 0 1

This number is 16*1+8*0+4*1+2*0+1*1=21. The placeholder value is simply 2^n, where n is the number of digits from the right. This method should help you visualize the binary base as you do with the typical (decimal) base until you become familiar with it.
 
It would be 4095 total there. Each bit is worth twice that of the previous one (going from right to left) with the first worth 1. If you just go through and multiply each successive one by 2, it shows you the last one is worth 2048. By virtue of the binary system, a set of all ones will total one less than the value of the next decimal place (in this case 2*2048, or 4096.) One less than that is 4095.

This works the same way as the decimal (base 10) system. When you max out one position (at 9, 99, 999, etc), the value adds up to one less than the next position; 9 = 10 - 1, 999 = 1000 - 1. That same applies in binary and is the easiest way to add up a big string of ones (or mostly ones).
 
Originally posted by: Fistandantilis
I am a bit confused here and need a little push,

1111 = 15
1111 1111 = 255
1111 1111 1111 = 2815? OR 270

the first set of bits goes to a highest value of 15, the first and second set goes to 255. now I am lost at what does the third set make, does the rightmost bit position equat to 1, 0 or does it go to 256
I know this is a bit confusing and I have searched my textbook and the sets of bits they give are all done in sets of 8, I am working with a set of 12, please any help would be greatly appreciated
The spaces you are inserting in your numbers may be confusing you. They are really only there to break up long strings of numbers so that they are easier to read. This is similar to how we use commas for decimal notation. 1,234,567 == 1234567 the same as 1111 1111 1111 == 1111111111111111. They are equivalent, but one is easier to read. Sets of 8 and 12 are really irrelevant. We could just as easily break up decimal numbers in to sets of 4 instead of 3 and the math wouldn't change. The difference between 1,2369,2535,8245 and 1,236,925,358,245 is merely notation. They represent the same thing.

Saying that 1111 1111 + 1111 = 1111 1111 1111 is similar to saying 255 + 15 = 25515. Written in a familiar number system it should be easier to see why this is wrong. If you want to break a binary number down by parts it is done in a similar way to the decimal system. 1,234,567 = 1,000,000+234,000+567 the same as 1111 1111 1111 = 1111 0000 0000 + 1111 0000 + 1111 (3840 + 240 + 15 = 4095)

The hardest part about using math in a different base is "learning" all of the tricks that you already know, but don't realize you know them. You've used these tricks all of your life and they have become rote memorization. Multiplying by 10 is easy, right? So is multiplying by 2 in base 2.
 
Back
Top