Training session 3: Number Systems
Difficulty: Extremely Easy
Learn the use of Number Systems and how to convert between them
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
Octal base 8
Decimal base 10
Hexidecimal base 16
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:
NOTE: the first collumn in binary is always 1 because the number is odd
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.
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
Simply read off the Decimal equivilant of the number and you get
4 and 5
Meaning 01000101 in Hexidecimal is 45
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:
To convert Binary to Octal just do the same with groups of three instead. The process can also easily be reversed:
C 0 D E
1100 0000 1101 1110
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.