Binary MADNESS Part I

Ok so this is more so I don’t forget it, than because I think anyone will read it or care. But on the off chance you care about this kind of thing, here is what I learned about binary:

The position of the number indicates a multipul of the base of the number system (2) the same as what we have in the human base 10 number system.
So a 1 in the ones column gives us 1: 0001
And a one in the twos column would give us two: 0010
A one in both the ones and twos column gives us three: 0011
And the columns double in value as they move left. So 0100 is four, and 1000 is eight and adding a fifth column will give us sixteen and so on.


Adding binary numbers is pretty simple.
1+1 = 0 and carry 1 to the next column.
1+1+ a carry of one = 1 and a carry of one.


0111 (aka 7)
1110 (aka 14)


Ok this is a little weird. Computers don’t subtract. Well they do, but they do it by adding a negative to a positive. To create the negative number, called a twos compliment, you need to flip all the bits (change all the ones to zeros and vice versa) and then add one. It sounds simple but I screw it up pretty consistently, so I was very happy to find an idiot resistant method of finding a twos compliment just in time for my final exam:

Working from right to left, ignore any zeros and find the first one. Keep it the way it is flip all the other bits like so:

0111 (aka 7)
1001 (the twos compliment of 7)


1110 (aka 14)
+1001 (plus the twos compliment of 7)
0111 (equals 7!)

Technically it equals 10111 but computers can only work with so many bits at a time (the newest can now do 64 bits at a time, older ones just 32). In this case we are working with 4 bit numbers so any carrys from the addition will just be dropped. So the 1 on the far left will be chopped off leaving us with the 0111.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s