Advertisement

binary and hex

Started by July 18, 2008 06:32 PM
6 comments, last by AtomicWinter 4 years, 11 months ago
I am having some trouble grasping the concept of binary and hexademical numbers. Can someone please point me towards a decent explanation of them.
---------------------------------------------------------------------------------------Exercise, eat right and be the best you can be!Translation: Play video games for finger streangth and eat lots of hot pockets to be at top programming efficiency.
I'll quickly try to explain it as well as I can...

First, lets start with the normal number system. It is also known as "Decimal". The prefix Dec- means 10 which is exactly what the system has. Decimal is a system of 10 different values (0 through 9). At the most basic level, that is how the designations work. Binary is based on the prefix Bin- which means 2. Consequently binary is a system of two discrete values, 0 and 1 (Number systems start as 0). Hex is a shortened form of hexidecimal. Hex means six, and Dec means 10 so if you put them together, you get a number system of 16 discrete values. Since there are only 10 numerical digits as we know them, we use letters for the rest so that gives us 0-9 and A-F.

So, that gives up an equivilency of:
0 1 2 3 4 5 6 7 8 9 A B C D E F
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

At the most basic level, it is as simple as that. The next thing is converting between the different systems. Converting between decimal and binary is very easy, since each place is equal to 2^(the space - 1). But thats for another post.
There was a saying we had in college: Those who walk into the engineering building are never quite the same when they walk out.
Advertisement
Base-10 numbers, the numbers you deal with everyday, can all be written as sums of powers of 10. For example, we can rewrite 1234 as

1*10^3 + 2*10^2 + 3*10^1 + 4*10^0 = 1000 + 200 + 30 + 4 = 1234

Similarly, with binary (base-2) we can rewrite numbers as sums of powers of 2. For example we can rewrite 1011

1*2^3 + 0*2^2 + 1*2^1 + 1*2^0 = 8 + 0 + 2 + 1 = 11 (in base-10)

It should now be no surprise that we can do the same with base-16. For example 1A3 (remember A = 10)

1*16^2 + A*16^1 + 3*16^0 = 256 + 160 + 3 = 419 (in base-10)
Read chapter1 on this webpage and check out the workbook on the same page and it should all become clear and you'll also get to laugh when you see this old programmer joke:
"There are 10 types of people in the world: those who understand binary, and those who don't."
[size="2"]Don't talk about writing games, don't write design docs, don't spend your time on web boards. Sit in your house write 20 games when you complete them you will either want to do it the rest of your life or not * Andre Lamothe
omg I actually got 90% of those jokes..... I'm So ASHAMED ;7(= ooooohhh look at that I got a gote and a nose!!! ;7(= look sideways
---------------------------------------------------------------------------------------Exercise, eat right and be the best you can be!Translation: Play video games for finger streangth and eat lots of hot pockets to be at top programming efficiency.
Might I ask why you're trying to learn these?
There was a saying we had in college: Those who walk into the engineering building are never quite the same when they walk out.
Advertisement

This topic is closed to new replies.

Advertisement