Binary code, Hexidecimal code and Positional Number Systems
The Decimal System and Positional Number Systems
Binary Code
The Decimal System and Positional Number Systems
Our every-day number system is called The Decimal System. The word Decimal comes
from the Latin root dec meaning ten. We use the ten digits 0-9 and caculate in factors
of 10. This is numbering system seems natural to us but is arbitrarilly based on the fact that
humans have ten fingers. Early humans counted only on thier fingers and when they got to the
tenth finger they had to use something else to signify a number higher. When humans began writing
this method continued. We start counting at 0 and after 9 we move to two digits. This is may seem
obvious, but our numbering system could have just as easily been based on 5, 12 or 23. When we count up
from zero and get to ten we now have a 1 in the tens position ans a 0 in the ones position.
If we were to keep counting to 100 we would then have a 1 in then hundreds position, a 0 in
the tens position and a 0 in the ones position. This what is meant by a Positional
Number System. For example, the number 529 could be represented as such:
5 hundreds
2 tens
9 ones
Theoretically, we could invent a different character for each number but all those
characters would be hard to remeber and make math very difficult. This is why Roman numerals
lost favor to the Arabic-Hindu system we use today. In the Roman system the digits 1, 2, 3 were
represented as I, II, III. Makes enough sense 1 = I, 2 = II and 3 = III. It gets confusing when
you get to four as 4 = IV. What? Why not IIII? Well, V is 5 in the Roman system and 1 before 5 is 4,
so you put the I before the V to make IV. Then, 10 = X (because if you put two V's together you get
X), 50 = L(??????), 100 = C (From the Latin Cent, meaning 100), 1000 = M (From the Latin Mill, meaning 1000).
Roman numerals look nice on clocks and on old buildings but try this math:
IVCM - XXIII
Or
LCMV + DMX
Even if you attempted solving these, you would probably have to convert the numbers to Decimal and
then the answers back to Roman.
The Romans were not alone in this perdicament, the ancient Hebrew and Greek alphabets were also used to
represent numbers.
Binary Code
Computers don't have fingers to count numbers on, they don't even know what numbers are. Computers
are made up of millions of switches. These switches can either be ON or OFF. This is Digital
switching, from the Greek root di meaning two. This is where Binary code comes in, from
the Latin root bi meaning two. Binary is represented by 1 and 0. Just as the Decimal system
has ten digits(0-9), Binary has two(1 and 0). The numbers 0 and 1 are for human reference only.
The computer knows nothing about numbers, only that a siwtch is ON(1) or OFF(0). At some point you
may have seen a theater marqueue with hundreds of lightbulbs on it. The lightbulbs go on and off
in a rapid sequence that spells out words humans can read. A single lightbulb being turned on and off
is meaningless, but hundreds in of them synchronized can create words and pictures. This we communicate
with computers. We send instructions for the computer to turn on certain switches and turn off other
switches. In return, for each different combination of on/off switches the computer does something
different.
One switch(one 1 or one 0) is called a bit. Eight bits (eight ones and zeros) is called a
byte. The byte is basic unit in binary code.
01100101
10101110
01101000
Each one of the above sequences means something different. This is where the math comes in. Within the
byte, each position is valued differently, unless it off in which case in is zero. A 0 bit is always
equal to zero. Think of the eight bits as different positions. Just as explained above, when a 1 is
in the ones position, it is equal to 1, when it is in the tens position, it is equal to 10.
Starting on the right, the positions have these values:
1st position equals 2 to the zero power (any number to the zero power equals 1)
2nd position equals 2 to the first power (2)
3rd position equals 2 to the second power (2 x 2 = 4)
4th position equals 2 to the third power (2 x 2 x 2 = 8)
5th position equals 2 to the fourth power (2 x 2 x 2 x 2 = 16)
6th position equals 2 to the fifth power (2 x 2 x 2 x 2 x 2 = 32)
7th position equals 2 to the sixth power (2 x 2 x 2 x 2 x 2 x 2 = 64)
8th position equals 2 to the seventh power (2 x 2 x 2 x 2 x 2 x 2 x 2 = 128)
Therefore 00101111 = 47
Memorize this number sequence
1 2 4 8
16 32 64 128 256
This number sequence is the basis for understadning computer logic. It will
appear over-and-over. For example, computer memory(RAM) comes in chip sizes of:
1, 2, 4, 8,
16, 32, 64, 128, and 256.
There are many different ways that binary numbers are represented at the computer's level,
here is a partial chart:
| Media | 1 | 0 |
| Hardware Switch | On | Off |
| Hardware Switch | Open | Closed |
| Electric Current | +5v | Less than +5v |
| Magnetic tape/disk | North | South |
| Optical | Light | No light |
| CD ROM | Light Passes | Light Blocked |
| Wave/Signal | High | Low |
| Pulse | Long | Short |
| Card/Tape | Hole | No hole |
In the real world, High can mean 0 and vice versa. In some cases it is better to have current
set to low to indicate a 1. The point is that there are two values and this is how they can be
represented through various media.
The Hexadecimal System
Hex
Octal and other systems
Octal
Binary Math
Binary Math
More
If you have windows, open the Calculator Program(Start/Programs/Accessories).
Go to "View" and change the selection to "Scientific." You
will be able to use Decimal, Hex, Octal and Binary. Add, subtract, multiply, divide and
translate between the various systems.
Hexadecimal Math
Hex Math
Practical Guide to Binary, Decimal and Hexadecimal Numbers
More
More