Tuesday, October 25, 2011

Binary Social Club: no-1 is a 0.


In the Binary Social Club no-"1" is a "0"
"Well maybe just a bit."
Looking for a Byte?

  In "Binary", or the base-2 (Bi- latin for "of 2") number system you only have the option of picking between 2 numbers rather than 10 like in "Decimal" (Deci- Latin for "of 10"). In computer code you choose between "1" and "0", or more physically as found in circuits- "on" and "off". Because that is exactly what computer code is- the passing of electric current through a series of circuits. When the current is on, it's a "1". When it's off, it's a "0". In counting those 1's and 0's we use "Bits". A"Bit" is a singular "1" or "0" in binary code. Think of it as a stream of electrons like this: -- --- - >where you see a "-" think of "1" and in its absence think of "0". So, in Binary, we end up with 11011101. Now Bits are joined together in groups of 4, so 1101 and 1101 from our example, and when you have 2 groups of four they measure up to 1 "Byte". So remember it like this: to take a Byte you need 8 Bits. By the way, our example "1101-1101" is binary for the decimal number 221. 




  Now the inquisitive minds out there might be wondering where I pulled that number from; complex math, Fibonacci, maybe my ass. If you guessed all 3 you're right! Have a Cookie! The digital kind with micro chips- I couldn't resist-er IT. See what a Computer Science education does to some1. OMG PLZ! Ok, I'm done. Anyways yes, unfortunately there is some complex math involved, as for Fibonacci he is actually the grandfather of Discrete Math and therefore Computer Math, and my ass is none of your concern but I may have pulled the original binary statement from it. But for you, and only you, I'll make the math part easy. 




  Let's look at our example "1101-1101" the 8-bit, or byte, code that means 221 in decimal. In Binary we read right to left, rather than left to right, using the powers of 2. We use powers of 2 because in Binary, no matter what you do, you'll always end up with either a "1" or "0" which is base-2. We count right to left because we work from our known points. We know that the furthest right-hand digit is going to represent the first set in Binary, "2^0", or 2 to-the-0 power- which is "1"(as understood in computer science). But hold up! This is where this whole Fibonacci-an puzzle gets confusing. You would only count that first place if a "1", or "on" light, was there. So, if their is a "0" in the furthest right place, then you don't count the "2^0" place-holder. Instead you'd go to the next place-holder just to the left, the "2^1" spot. If you had a "1" here you'd end up with "2*1" or "2". So in our code, so far, we have "01" or 1. To expand this, our example was "1101-1101" or "(2^7)+(2^6)+(0^5)+(2^4)+(2^3)+(0^2)+(2^1)+(2^0)" or "128+64+0+16+8+4+0+1 = 221. Remember this key "128.64.32.16.8.4.2.1". You've probably seen these numbers somewhere before like ratings for video game systems, processors, or operating systems. 




  That trend I showed you with the key keeps going up "exponentially" by factors of 2. So, our next set of 4-bits, would be "2048.1024.512.256". Do you see a  pattern? After 2^1, or 2, you just double the number directly to your right. Consider this a first lesson in "Combinatorics" or "Discrete Math" the only math you need to learn Computer Science. Leave the Calculus to people with OCD who want to perform world shattering studies like counting grains of sand on a beach, or the path a rubber ball will bounce after I bee-line it off there forehead.  


Binary-Decimal Conversion Tool


Binary to Text (ASCII) Conversion Tool

No comments:

Post a Comment