Overclock.net banner

1 - 9 of 9 Posts

·
Registered
Joined
·
712 Posts
Discussion Starter · #1 ·
The ID10T's Guide to Binary, Hexadecimal, and Decimal Numbering

Why do we need to know what the numbers mean when we can convert them directly in our calc.exe programs? The answer is simple really. You can do alot more with the numbers if you know what they mean and how they are organized. Especially with IPV6 coming up shortly it will be imperative to understand HEX. Binary conversions is required for parts of the A+ and CCNA exams. HEX is required for MANY certifications. Understanding HOW to convert the numbers is merely counting, the WHY is so you can look at data in your machine and have a greater appreciation for their meanings and magnitudes.

First let's start with the decimal system. The reason will become apparent later on but for now I'm going to teach you the right way to count. The Decimal System is named for the latin for the word TEN. Deci, Decare. This is because we use ten digits to count. 0-9. 10 is not actually a number by itself. It is a composite number meaning 1x10^1 .... all you have to remember that any number to the first power is that number. When you get to 11 you have just made the equation (1 x 10^1)+ 1 . this goes on and on till you get to one hundred or, 1 x 10^2, simplified even more as 1 x (10 x 10)
For a quick Idea of what all this means let's look at this in a list

1 x 10^1 = 10
1 x 10^2 = 100
1 x 10^3 = 1,000
.
1 x 10^10 = 10,000,000,000

see a pattern? Of course you do... you've been using these numbers since gradeschool. You count from 0 to 9 then add a one in front of the 9 and reset the 9 to a zero and start counting again. Simple.

Binary works the same way. There is nothing different you just use 2 digits. The name comes from the latin bino, binare meaning dual or two. Counting works the same way. You simply start with 0 and count to one. Then you add a one in front of the first digit and reset the first digit back to 0. This gives us the Joke "There are exactly 10 people that understand binary... thsoe that do and those that don't" hopefully after this you will be in the DO column. This counting rapidly goes through the same process. By padding the first couple digits with 0's I'll show you the pattern.

0000 = 0
0001 = 1
0010 = 2
0011 = 3
0100 = 4
0101 = 5
0110 = 6
0111 = 7
1000 = 8
1001 = 9
1010 = 10
1011 = 11
1100 = 12
1101 = 13
1110 = 14
1111 = 15

In this you can see how the number of IRQ's in a computer was originally only 16. There was only 4 bits to store the address number and using 4 bits in binary you can only produce 16 numbers 0-15 ...

Another way of looking at binary is like this.

1x10^16 1x10^8 1x10^4 1x 10^2 1x10^0 (1)
---------------------------------------------------------
1 0 1 1 0

now... you see the powers that each of the numbers are in? Add the numbers of the powers in each column together.

You should have this 16 + 0 + 4 + 2 + 0 = 22

Now go type in 22 into your calculator on scientific mode and then press the binary radio button... what do you get? You just did your first manual binary conversion to decimal.

If you want to go the other way you can do it like this... take the number 47 for instance. First we need to figure out what the highest binary power that can go into 47 is. you can make a chart like this... The numbers may look familiar to you... they are the binary powers that determine all computer values.

1024 512 256 128 64 32 16 8 4 2 1
--------------------------------------------------------------

now... numbers just keep growing by multiplying them by 2. We have more than enough for now though. Taking 47 we see that the first number that can go into it is 32. subtract 32 from 47 and place a 1 in the column underneath the 32. We are left with 15. looking at the next smallest number we see that we cannot subtract 16 from 15.... place a 0 in that column. on to 8 which we can subtract from 15. we are left with 7. place a 1 in the column under the 8. now... most people memorize the first 4 places (numbers 1 to 15) of the binary system to make the last part easier. If you saw the chart at the beginning you would already know the rest of this number when we had 15 left over. but if you didn;t... keep going... subtract 4 from 7 and we have 3, place a one in the 4 column. subtract 2 from 3 and we have 1 left over. Place a 1 in the two column. and of course we only have 1 left over so place a 1 in that column. The completed chart looks like this...

1024 512 256 128 64 32 16 8 4 2 1
--------------------------------------------------------------
0 0 0 0 0 1 0 1 1 1 1

so our binary number is 10111... go ahead and pop it into the calc to check the answer and you have just done your first manual decimal to binary conversion. You should also be able to correlate these numbers to values you see in your computers every day. computers don;t actually understand decimal or hexadecimal... It has to convert those numbers to binary to do anything with them.

Now on to the fun part. We know that Decimal uses ten digits and binary uses 2... but Hexo, Hexare means 6 in latin... giving us the 10 + 6 numbering system we call Hexadecimal or BASE16. Hex uses the same numbering systems as the other two.. it just counts up to 9 and then continues in the english alphabet up to F before adding the next placeholder. You can visualize this with this brief chart.

01
02
03
04
05
06
07
08
09
0A = 10
0B = 11
0C = 12
0D = 13
0E = 14
0F = 15
10 = 16

Also see a correspondence here? Mabey memory addressing? We use hexadecimal because when dealing with larger numbers it makes them more human readable. You may also be familiar with these numbers if you've ever played with a hex editor or with your Game Shark cheating device. To convert you do the same thing as with binary but with much larger powers. I'll leave off the 1x10 part and just draw up another chart. Because it's BASE 16 you'll be multiplying higher numbers by 16 instead of 2 like you did for binary. As you'll see they go up FAST

4096 256 16 1
-----------------------

Now let's challenge you a little bit in the conversion. Try B32Cx0 (The x0 usually means it's a hex number but is not always used. Usually if you only see 1's and 0's it's binary and if you see any letters it's hex but there are exceptions so it's important to specify)

Let's plop the numbers and or letters in each column and see what we get.

4096 256 16 1
-----------------------
B 3 2 C

Now... do we remember the chart from earlier on in the lesson with the values from 1 to 16? grab it and sub these values in with their corresponding letter.

4096 256 16 1
-----------------------
B 3 2 C
11 3 2 12

Now that that's done we need to multiply some stuff out and add the results. Multiply the top numbers times the numbers you substituted in at the bottom. You will get somethign like this.... 4096 x 11, 256 x 3, 16 x 2, 1 x 12. Add up all those results when you're done. (45,056 + 768 + 32 + 12) you will get a total of 45,868... or B32C in hex...

doing the reverse is just the same way as you did in binary above only with the chart from above.

Take the number 32,972 for example. We start by fiiguring out how many times the highest number can go into 32,972.

65,536 4096 256 16 1
---------------------------------

Well the first one isn;t going into it so we start with the second and find that 4096 can go into 32,972 8 times cleanly... place an 8 in that column. do some quick multiplication of 8 x 4096 and you get 32,768. subtract that and you are left with 204. 256 can't go into it so place a 0 there. On to 16 which can go into 204 12 times cleanly. Once again multiply it out and you get 16x12=192. When you subtract it you get a remainder of 12. so now we have this.

65,536 4096 256 16 1
---------------------------------
0 8 0 12 12

Still not in hex form yet is it? Convert the numbers higher than 9 to hex usign the chart at the beginning of this section. You get this.

65,536 4096 256 16 1
---------------------------------
0 8 0 12 12
0 8 0 C C

Your finished binary number is 80CC or 32,972. congratulations you just manually converted hex numbers!

But what about converting hex to binary? Go through decimal. Convert your hex into decimal then into binary... and vice versa to go from binary to hex. Trust me it is FAR shorter than actually figuring it out the long way.

Well now you know the basics of Binary, Hex, and Decimal numbering and conversions. I hope this guide enlightens you on what some of the seemingly random mumbo-jumbo means in your computing endeavors.
 

·
Linux Guru
Joined
·
5,734 Posts
Few people other than Net Engineers and Admin really need to know comp numbers, can you please list some uses for Hex and Binary to the average user?
 

·
Registered
Joined
·
446 Posts
Kid at my school was counting in binary, he said he got up to like 250
 

·
Linux Guru
Joined
·
5,734 Posts
Quote:

Originally Posted by DesT
Kid at my school was counting in binary, he said he got up to like 250
That is funny because Binary is very simple, once you get to 250 it's cake to make it to 255
 

·
Registered
Joined
·
712 Posts
Discussion Starter · #5 ·
Quote:

Originally Posted by mfillpot
Few people other than Net Engineers and Admin really need to know comp numbers, can you please list some uses for Hex and Binary to the average user?
sure... I use hex all the time when adjusting game shark codes on my PS2 or game cube. It also comes in handy when tryign to use a memory editor on other programs to edit values. 90% of information stored in numerical databases for games (Like Diablo 2 for example) use extensive HEX tables to handle their values. I have used my knowledge of HEX to completely modify the entire game. Also all of the computer's memory is addressed in HEX values. Usually these are sequential. If you get memory errors and can track down the decimal value you can tell where in your memory banks the problem is. (ist dimm or second or etc etc.) And as I said you can always just punch the numbers into your calculator and convert them... I just drew this up for people that actually WANT to know what the numbers mean and how they relate to the system.
 

·
Registered
Joined
·
446 Posts
What a coincidence, my math teacher showed us how to count in binary the same day, he doesnt even have that class either....
 

·
Registered
Joined
·
147 Posts
Nicely done the only prob is we learned bin, hex and dec already on primary school. In the first grade we learned dec and in the 5th binary and hex.
 

·
Premium Member
Joined
·
3,983 Posts
Binary is good to know for networking and setting up some SCSI drives. Nice job Kittani! Ill have to read the hexidecimal section later since I never learned it. It always seemed like too much of a pain in the ass.
 
1 - 9 of 9 Posts
Top