And call me in the morning…
I’ve been sick, well, actually I’m still sick but a couple of pills can go a long way to dull out a headache. It’s still hard to think so I’ll keep this post short and just talk a bit about binary.
I remember my first class of computer science, the teacher was/is an… interesting… character [but in a good way]. He walked into the classroom, yelled out his name and asked us how do we order 31 oranges if we only have one hand…
Binary is not a difficult base, not any more than any other base, my biggest hurdle of it at first was my inability to separate the value of a number from its representation. Let’s make some orange juice.
Say I have five oranges; I can count them, physically in front of me are five oranges. I can use a decimal representation for them “5” or I can invent my own representation of that value “*”. Either way, the value doesn’t change, it is the symbol representing them which does.
Right, now we get to the base representation. If we already know how to use decimal numbers [base 10] then really we know how to use all bases.
Base 10 [Decimal]
Value range: 0->9
1000 100 10 1
0 0 3 1
Our representation here reads: 31
Let’s calculate the actual value though;
So our value is the same as our representation [makes sense since I used decimal representation to represent the value in the first place].
now in binary.
Base 2 [Binary]
Value range: 0->1
16 8 4 2 1
1 1 1 1 1
Our representation reads: 11111
Let’s calculate the actual value;
Same value, different representation. Notice the similarities between the base representations:
Value Range: 0->(X-1)
...(X*X*X) (X*X) (X) 1
With computers we find that two bases are important, base 2 [Binary] and base 16 [Hexadecimal] because:
A. Computers “think” in binary, everything we write is actually encoded electronically as .
B. Hexadecimal representations are more compact than binary and are easily converted to binary [every bit field in the hexadecimal column corresponds to 4 bits in binary].
That’s it, nothing too complicated but it taught me an important lesson; don’t confuse the value of an object with the representation of its value. My pills are running out and my head is throbbing again but at least the dishes are done.
“Who’s gonna cry when old John dies?”