|
Counting in Binary
It's easier than you think to count in binary. Remember that the usual system we use for counting, decimal, is a positional number system: the same digit can represent a different quantity depending on where it occurs in the number. The number 4, for instance, can mean just that, or it can signify four hundred (400), or four million (4,000,000). The zeroes themselves have no value - they just indicate how much the digit 4 is worth. There are 10 separate digits in the decimal system, so when you hit 9 you run out of digits and you add another digit on the left: this is the tens column where each digit is worth 10 times what it was in the units column.
201 decimal
201 / 2 = 2 * 100 + 1
100 / 2 = 2 * 50 + 0
50 / 2 = 2 * 25 + 0
25 / 2 = 2 * 12 + 1
12 / 2 = 2 * 6 + 0
6 / 2 = 2 * 3 + 0
3 / 2 = 2 * 1 + 1
1 / 2 = 2 * 0 + 1
11001001 binary
Binary is the same, except that you run out of digits a lot more quickly, but you put another digit in a new column to multiply it by two. So, the number one in binary is represented as 1. Two, however, is 10. Three is 11 and four is 100. Instead of each column representing units, tens, hundreds and thousands, you have units, two, fours, eights, 16s, 32s and so one-each new column multiples the entire number by two. The table on the next page makes it clearer.
You'll notice a number system called hexadecimal there too. Hexadecimal, hex for short, is a base 16 digits you can use before you have to go to the next column. Rather than inventing new symbols, hexadecimal notation just uses the digits zero to nine plus the first six letters of the alphabet, A to F. If you've probably come across hexadecimal already : colours are often defined with hex numbers. So why indulge in this perverse and unintuitive hex system? Well, because each extra digit in a binary number represents a power of two, computing is often concerned with powers of two. The standard unit of computer memory, for instance, is a byte. A byte consists of eight bits (23), in other words eight values that can be either one or zero. With eight bits, you can represent 256 different values (28). Because there are 16 digits in the hexadecimal system, two hex digits can represent all the possible values of a single byte-zero is 00, 255 is FF-keeping everything neat. So, when you specify a colour of #FF00FF in a web page, you're giving the web browser a three-byte, 24bit colour value: one byte for red (in this case FF), one for green (00) and one for blue (FF). This, incidentally, is the official web standard colour 'fuchsia'.
DNDaily.com - Your Daily Domain Doze
Twut.com - Free Online Games
Product reviews and ratings
Search Engine Optimization Packages
|