Advanced Number Systems made easy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Please turn wordwrapping on in your plain-text editor. If you use windows I recommend notepad.exe. Please note that if you already know how to convert between different
bases then you really don't need to read this. But if you haven't learned
this yet, then this will be a definite text for you.
This is the very first tutorial that I have ever published and I want you to send every single comment you have and every single thought you think, while reading this, to my email address written near the end of this file. I have divided this into two chapters. Chapter one explaining what you have to know, before you can make your own conclusions and methods. The second is a short one just to finish off with what you probably wanted to learn by reading my tutorial. The first chapter is the most important, and you shouldn't skim past anything you don't quite understand. I promise that when you have read this file, and thought about the things in here, you will have an indept knowledge of how the complex numeral systems work. If you want more than that, I suggest that you, after reading, make a list of numbers and values and then convert them to everything you can think of. Just remember that, practice makes perfect. -snider
What is a base? A base is what defines all the different numbering systems.
It defines how many different digits, a numbering system has. To start,
the decimal system has 10 different numbers (0-1-2-3-4-5-6-7-8-9, (count
them for yourself)) and is therefore base 10. Now the big question arises,
what to do when you hit 9 and want to add one more? Well, a lot of heads
smarter then ours put together the simple method of pushing the digits
around a bit. 10 was the result, which is actually built from 1 tens and
0 ones. 15 is 1 ten and 5 ones. Because the decimal system is base 10,
it also means that it works on the basis of the power of 10. The third
column in the decimal systems is therefore 100's. I will try to explain.
BASE 10 (decimal)
This is the chart I will be using in the rest of this tutorial, and it is important you understand this. From here you can simply read that the seventh column digit represent how many times there are 1000000's in a number. The number 65000000 will have 5 times in the 7 column and 6 in column number 8 (NOT 65 times in the seventh column). Since we write numbers with the most powerful first, I have chosen to set the columns up in the same way, with the first column, far left. But this is all very natural as we were taught math in school, when we were only seven. Since we have lived with that ever since, it is hard to imagine how it would be if we didn't have a numbering system with base 10.
***** ***** ***** | | | one ten | and five ones. Lets take the octal system. It is base 8 (0-1-2-3-4-5-6-7). Now (decimal)15 is:
**** **** **** *** | | one eight | and seven ones You see, it's still (decimal)15 asterisks, but now it is also (and has always been)
17 / \ one eight \ and seven ones The chart for base 8 is (as you probably could figure out for yourself by now) BASE 8 (octal)
AND
(This last chart is pretty abstract, so don't feel stupid if you don't quite understand it.) Got everything so far? Lets make some more conversions. Lets take (decimal)435 to base 7. BASE 7
Now, do we have anything in column 7? Lets try, 435 divided by 117646
won't do. What about column 6, 435 divided by 16807.. No. It is obvious
that the first digit is in the fourth column. So 435 divided by 343 is
1 and with a remainder of 92. Now we know our final number in base 7 will
be 1---, and that we still have 92 to convert. So 92 divided by 49(column
3) returns 1 with a remainder of 43. Now we have 11-- and 43 to convert
to base 7. 43 divided by 7 is 6 and the remainder of 1. Now we have 116-
and the remainder of one. The rest is very easy to figure out as _n_ divided
by 1 always will return _n_. So our final base 7 number is 1161. And don't
think there are some times when it doesn't work out because of some weird
numbers, it will always work out since nothing but the format of the value
changes. Ok? Well so far so good. Lets go on with the how and why of base 5. BASE 5
The first column always have to indicate the lowest natural value possible,
that's one. The second column is the base^1, in this case 5. The third
column, base^2, in this case B^(C - 1) = column C's power. C = column
Welcome to the second chapter. Here we will attack the two number systems Hexadecimal and Binary. Lets start with the easy one: Binary... The binary numeral system is the longest way to write any value. Whatever value you choose to convert to binary, it will always be more digits than your original number. That is because binary is base 2. Only two numbers can be displayed, 0 or 1. Yes or No. True or False. Power or No power. The heart of any computer system (for now). With the formula in the last chapter we can figure out how to convert a base 2 system to base 10 numbers. BASE 2 (binary)
That's 10111! As I said, very hard to read for human beings. This is why Hexadecimal was invented (yes and I do mean _invented_).
Hex is a base 16 system, and therefore it is very advanced, but still
easier to read than binary. And extremely easy to convert to and from
binary because of some simple logical rules. Lets begin. BASE 16 (hexadecimal)
(The power is still displayed in decimal) I will leave it to you to get comfortable with converting from decimal to hex and vice versa. Now, converting from binary to hex and the other way around is simple. Lets look at them both. Do you see how hex jumps from one to sixteen in one column and how binary
jumps from one to sixteen in four columns? This is the breaking point
of the story. For every four binary digits they represent the value of
one hex digit. Why? Well, because So, when you want to convert binary to hex you part the number in four columns each. (decimal)155 = (binary)10011011 part it, and calculate a little..
1001 1011 | | 9 B final... (decimal)155 = (hex)9B The trick always works. (Actually it's not a trick but a logical, mathematical functionality :P) This is the end of Chapter 2.
Thanks for reading..
Have you ever been cracking a program and get sick and tired of doing the math and such to convert hex to ASCII? Well, you won't need to anymore. This list has all the keys on a keyboard and there hex values. So now you won't have to convert hex to binary and then look up what 0110000101100010 (ab) is in ASCII. So here it is:
Crash Course in Binary to Hex Conversion |
Credits: |
written by snider Updated by: Prophecy |