|
|
Training session 3: Number Systems
Difficulty: Extremely Easy Learn the use of Number Systems and how to convert between them
Creator: m101
Ok, so you ask why would you wanna know how to convert binary to hexidecimal, or decimal to octal, well the answer is simple, computer systems work on signal's being either On or Off, so the binary system is used. But have you tried trying to remember the binary equivilent to decimal, its not that simple, so Hexidecimal was developed. And certain systems also use octal aswell. Now let us take a look at these number systems:
Binary base 2
1000101
Octal base 8
105
Decimal base 10
69
Hexidecimal base 16
45
So what is happening here is when the number in the first collumn reaches the base it becomes 0 and a new collumn is created such as shown below:
Binary
0000 =0
0001 =1
0011 =3
0101 =5
1001 =9
NOTE: the first collumn in binary is always 1 because the number is odd
Octal
0000 =0
0007 =7
0010 =8
0011 =9
Decimal
0000 =0
0009 =9
Hexidecimal
0000 =0
0009 =9
The 0's are kept before the value to act as a place holder, when working in other number systems than decimal this can be very handy as i will show later.
One system used to convert Decimal to Binary is called the remainder method. This method uses repeated divisions using the base number of the system. In this case it is Base 2.
Example:
Convert the decimal number 192 to a binary number.
192/2 = 96 with a remainder of 0
96/2 = 48 with a remainder of 0
48/2 = 24 with a remainder of 0
24/2 = 12 with a remainder of 0
12/2 = 6 with a remainder of 0
6/2 = 3 with a remainder of 0
3/2 = 1 with a remainder of 1
1/2 = 0 with a remainder of 1
Write down all the remainders, backwards, and you have the binary number 11000000.
Now to convert Decimal to either Octal or Hexidecimal is somewhat easier:
Take the binary number 01000101 and split it into groups of four such as below
0100 0101
Simply read off the Decimal equivilant of the number and you get
4 and 5
Meaning 01000101 in Hexidecimal is 45
Another example:
1011111100101101
Break it into groups of four
1011 1111 0010 1101
11 15 2 13
Now since Hexidecimal is base 16 we use letters after 0..9 so we get:
BF2D
To convert Binary to Octal just do the same with groups of three instead. The process can also easily be reversed:
C0DE
C 0 D E
1100 0000 1101 1110
1100000011011110
The number is easily converted into binary.
Try this for yourself, although it might seem just like the maths you do at skool, it has a far more interesting use.
|
|