*If it weren't for this bulky title, this
page would load in a good 5 seconds!*

*And no, this doesn't mean I'm getting rid of it.*

## A. What are numeric systems?

B. Binary

C. Hex

D. Uninteresting stuff I like to brag about. :)

Glad you asked. A *numeric system* is a set of characters and mathematical
rules that are used to represent a number.

These numeric systems gave birth to our own. Some examples are the Roman numeric system (you know, Roman Numerals), the Chinese numeric system, the Greek numeric system, and the Arabic numeric system. Our contemporary numbers are based on that last one.

What we use today. The most used system is the base 10 or decimal system, which uses a base 10 for operations and is consequently very simple to use (given that we've been learning it from day 1 in Pre-school!). The other systems are the hexadecimal system and the binary system. These systems use a base 16 and a base 2, respectively. The hexadecimal and binary systems will be discussed in their respective chapters.

Why do we use the base 10, you ask? Look at your own two hands and count your
fingers! The word "digit", by the way, originates from the Latin word
*digitus*, which means "finger". In Russian, the word that means
"five" is very close-sounding to the word meaning "hand with
five fingers spread out".

So how does it all work? We have all learned in school that each digit in a number corresponds to the number it represents times the value of its place. For instance, 341 equals 341 because (3 x 100) + (4 x 10) + (1 x 1) = 341.

Representing this graphically, we'd have:

100 |
10 |
1 |

3 | 4 | 1 |

As we observe, each column header's value equals 10 times the place to the
right of it. From there the designation *base 10*.

The binary system has a base 2, which means each column's value equals 2 times the value of the one to the right, starting with the rightmost digit, which equals 1. It uses the arabic digits 0 and 1 solely. Take the number 1000111101001, for instance. Representing it graphically we have:

4096 |
2048 |
1024 |
512 |
256 |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |

1 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 1 |

So we have:

(1 x 4096) + (0 x 2048) + (0 x 1024) + (0 x 512) + (1 x 256) + (1 x 128) + (1 x 64) + (1 x 32) + (0 x 16) + (1 x 8) + (0 x 4) + (0 x 2) + (1 x 1) = 4096 + 256 + 128 + 64 + 32 + 8 + 1 = 4585

There! 1000111101001 in the binary system equals 4585 in the decimal system! Now for the complicated part.

You've seen how to convert numbers from binary to decimal. Well, how about vice-versa? That's what you'll see in this section. Let's convert the number 500. First write down the places from right to left until you get to a number higher than the one to be converted, like this:

512 |
256 |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |

Now, write down a zero under 512:

512 |
256 |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |

0 |

From now on, the scheme is simple: take the place immediately to the right. If it's smaller than or equal to the number, then write a 1 under it, subtract the place value from the number and use the result on the next place. If it's bigger, write down a 0, don't subtract, and go to the next place. On the table above, 256 is smaller than 500, so write down a 1 under 256 and subtract 256 from 500. Then use the result (244) on the next place. So we have:

512 |
256 |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |

0 | 1 |

128 is smaller than 244, so write down a 1 under 128 and subtract 128 from 244. Use the result (116) on the next house.

512 |
256 |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |

0 | 1 | 1 |

And so on for the rest of the calculation:

512 |
256 |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |

0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 |

See? It's simple! From this simple algorithm, you converted a decimal number
into a binary number. 500 in decimal equals 111110100 in binary.

OK, you've learned the binary system, how to calculate from decimal to binary
and vice-versa, and now it gets a bit more complicated.

The hexadecimal system, or hex, has a base 16, which means that each column
equals 16 times the one to its right, starting with the rightmost column, which
equals 1. Like this:

etc... |
1048576 |
65536 |
4096 |
256 |
16 |
1 |

The hexadecimal system, besides the digits 1 to 9, also uses A, B, C, D, E, F; which equal 10, 11, 12, 13, 14 and 15; respectively.

Here, we will convert the hexadecimal number 7EF. Remember that the rightmost digit equals one and each digit to the left equals sixteen times the digit immediately to its right. Write out the column headers from right to left until you have acheived the number of digits in the number. (if there are three digits in the number write three columns, for instance). Then write the number 1 at the rightmost column, like this:

1 |
||

Then write 16 (1 x 16) on the column to the left of 1; and 256 (16 x 16) on the column to the left of 16.

256 |
16 |
1 |

Next, write each of the digits of the number in the table.

256 |
16 |
1 |

7 | E | F |

Now multiply each hexadecimal digit by the number on its respective header (remember that A-F represent 10-15 respectively)

256 x 7 = 1792

16 x 14 (E) = 224

1 x 15 (F) = 15

Then add up the results:

1792 + 224 + 15 = 2031

And there you have it! 7EF in hex equals 2031 in decimal.

OK, to convert from decimal to hex, it's a wee more complicated (Note that
I've been saying this in the entire home page. I guess I wrote this in growing
order of complication =) ).

First, let's choose a number to convert. For this example I'll use 293. Next,
write down a table just like the last topic: from right to left, each table
header with a number 16 times larger than the number to the left, starting with
1. Write down headers until the header is higher than the number to be converted.

4096 |
256 |
16 |
1 |

Place a 0 under the table header that is larger than the number to be converted (the first one, logically). Then, divide the number to be converted by 256, which is the highest header lower than the number.

In this case, 293 divided by 256 equals 1, with a remainder of 37.

Next, write down the result (1) and use the remainder (37) for the next calculation.

4096 |
256 |
16 |
1 |

0 | 1 |

Now divide the remainder of the last calculation (37) by the next header (16)
-- 37 by 16 equals 2 with a remainder of 5.

Write down the result (2) under 16 and divide the remainder (5) by the next
header (1)

4096 |
256 |
16 |
1 |

0 | 1 | 2 |

5 divided by 1 equals 5 with no remainder, so put 5 under 1 and you're done.

(note: if in any of the calculations the result has no remainder, simply place the result under the respective header and put 0 under all the other headers to the right.)

4096 |
256 |
16 |
1 |

0 | 1 | 2 | 5 |

There! 293 in decimal equals 125 in hex.

**Over 10,000 hits in the first 3 years
(96-99) of operation!**

**This page was visited
times since it was re-upped
(September '99), but only after I got my lazy butt to put a counter in here, believe ir or not, 2 years later (September '2001) :)**

**Page by Hierosolyma
Kadathian. E-mail
me if you want to.**

Oh yeah, follow this if you want to go back to the top.