If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Numbering Systems - Conversions

Numbering Systems
Note: I have searched the tutorials forms and not found anything like this, If i'm stepping on anyones toes, or posting information already available neg me to death and i'll delete it. Anyways here you go. I had to do a numbering system tutorial for my fellow students, hopefully this will help ya'll out.

Decimal - The decimal numbering system is what we all know and use. It contains 10 digits (0 - 9) and then columns representing ones (10^0), tens(10^1), hundreds(10^2), thousands(10^3) and so on.
Binary - On and Off... A One or a Zero. This is the system that computers know and recognize. It contains 2 digits (0 - 1) and columns representing powers of 2. One (2^0), two ((2^1), four (2^2), 8 (2^3) and so on.
Octal - A number system using 8 digits (0 - 7). It is now considered to be somewhat archaic and is no longer used as much as it was in the past. The columns in octal represent powers of 8. One (8^0), 8 (8^1), 64(8^2) and so on.
Hex - A number system using 16 digtals (0 - 9 and A - F)... The letters represent the numbers 10 (A) - 15 (F). Hex is used all the time in the computer world. In MAC Addresses and Packet Captures, in programming, and in IPv6. The columns in hex represent powers of 16. One (16^0), 16 (16^1), 256 (16^2) and so on.

All number systems follow the same method to determine the number. You multiple the Value of the digit in the column by the value of the column

Now obviously the values that are 0 x ?? are not necessary, but even so, a big number can be a pain in the ass to convert. Conversion between binary and decimal is by far the easiest. With a binary number you can make a chart at first, but after a while the calculations can be done in your head.

To convert 10 (Decimal) to Binary. First write out the values of the binary columns (like below). Now work your way down the chart to the biggest number that goes into 10. The answer is 8, so put a 1 there. Fill in all spaces before the 1 with 0s. 10 - 8 = 2. So now find a number that will go into 2. 4 won't so the next one is 2.... put a 1 there and 0s in between. 2 -2 = 0.. you're done so put 0s in all the remaining spots

2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
128 64 32 16 8 4 2 1
0 0 0 0 1 0 1 0

00001010 (you can drop all the leading 0s so your answer is 1010).

To convert the number back into decimal you would do the reverse process. Make the chart, and write the binary number in the columns. Then just add up all the column values where you put a 1.

How that we've done that.. let's look at converting octal and hex. The pattern for these two number systems is very similar.

The largest hex number is F which is 15 in decimal or 1111 in binary.
The largest octal number is 7 which is 7 in decimal or 111 in binary.

So if we take our first chunk of 4 bits we see 1010 which on our chart is A, the second chunk is also 1010 so it is A again. So our hex solution is AA.
Hex numbers can also be converted backwards this way... say you had the number 3C. 3 in hex is 0011 in binary and C in hex is 1100 in binary. So your solution is 00111100, which if you convert it using your chart:
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
128 64 32 16 8 4 2 1
0 0 1 1 1 1 0 0

If we work with the same number again, 10101010, for octal we break it into chunks of 3. We only have 8 digits so add an additional 0 to make it a mulitple of 3
010101010.. now we break that up and get 101 101 010
If we compare that to our chart, we get 2 for each chunk... or 252.

Again we can convert the octal back using this method... If we use 74.. We can break this up using the chunk method. We get 111 and 100, so the binary number 111100. We plug this into our chart and come up with

2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
128 64 32 16 8 4 2 1
0 0 1 1 1 1 0 0

Add up the columns and you get 60 in decimal.

Now you should be able to easily convert numbers between any base. I hope you all find this somewhat useful.

Always listen to experts. They\'ll tell you what can\'t be done and why. Then go and do it. -- Robert HeinleinI\'m basically a very lazy person who likes to get credit for things other people actually do. -- Linus Torvalds

Good post mate. I am here going to complete list of symbols. Here is Two popular coding schemes are ASCII AND EBCDIC which is stands for American Standard Code for Information Interchange(ASCII) Extended Binary Coded Decimal Interchange Code(EBCDIC)

Good post mate. I am here going to complete list of symbols. Here is Two popular coding schemes are ASCII AND EBCDIC which is stands for American Standard Code for Information Interchange(ASCII) Extended Binary Coded Decimal Interchange Code(EBCDIC)

Well i from smirc's post I owe a few people apologies... but now i'm kinda curious... does the search only work with posts back a certain date? I'm here typing binary and tutorial in the search engine and those threats still aren't coming up.