Showing posts with label Decimal. Show all posts
Showing posts with label Decimal. Show all posts

9/11/2009

[Theory] Number Base System

A hex dump of a binary executable fileImage via Wikipedia

Today we're going to look at the different Number bases and how to convert them. As allways, there are many ways of doing this and these are just my methods.

We're going to star with the easiest: Binary.
If you are a normal person (more or less) then you tend to think in a 10 base system. This means that there are 10 different signs to represent numbers in your system. Which are: 0,1,2,3,4,5,6,7,8,9. (Notice that 10 isn't a number, its a combination of two).
We call this the Decimal (DEC) system.

In binary (BIN) there are only two different symbols: 0,1. Its the easiest system to differenciate one number from another. Its either ON or OFF, its BLACK or WHITE, its 1 or 0.

Obviously, the more symbols we have to represent a number the less we have to write, but if we have very few symbols, like in the binary system, the number strings tend to become somewhat large.

Reading Binary:

Each position in a binary string represents a weight or value. Lets take this string as an example: [1101]
If there is a 1, we count that value of the position. If there is a 0 we ignor the position.
The values are the following: [1,2,4,8,16,32,64,128,512,1024...].

If we now look at our example string, starting from behind (right side), we have a 1. The 1 means we count the value. The Value for the first position (starting from behind) is 1.
Next comes the 0. Second position has the value 2 but we don't count that because of the 0.
Next number is a 1, which means again that we do count the value:4.
The last number in our string is another 1: The fourth position has a value of 8.

Now that we have gathered all the values, just add them together and you get the result of what that binary number looks in our decimal base.
1+4+8 = 25.

And thats how you can read binary.
Next we will check out some conversions from one base to another aswell as the Hexadecimal (16th) base which you might have heared from if you've done some Photoshop.
Reblog this post [with Zemanta]