Thursday, 23 July 2015

Conversion in Numeral system( part 1)

Conversion in Numeral system( part 1)


There are four types of Numeral system:
Decimal Base-10
Binary Base-2
Octal Base-8
Hexadecimal Base-16
0
0
0
0
1
1
1
1
2
10
2
2
3
11
3
3
4
100
4
4
5
101
5
5
6
110
6
6
7
111
7
7
8
1000

8
9
1001

9

1010

A

1011

B

1100

C

1101

D

1110

E

1111



F




How to convert Binary to decimal
The decimal numbers is equal to the sum of power of 2 of binary number’s ‘1’ digits place:






binary number:111001
power of 2:252423222120


1110012 = 1·25+1·24+1·23+0·22+0·21+1·20 = 57
Binary
base 2
Decimal
base 10
0
0
1
1
10
2
11
3
100
4
101
5
110
6
111
7
1000
8
1001
9
1010
10
1011
11
1100
12
1101
13
1110
14
1111
15
10000
16
100000
32
1000000
64
10000000
128
100000000
256


How to convert from octal to decimal

A regular decimal number is the sum of the digits multiplied with 8n.

Example #1

37 in base 8 is equal to each digit multiplied with its corresponding 8n:
378 = 3×81+7×80 = 24+7 = 31

Example #2

7014 in base 8 is equal to each digit multiplied with its corresponding power of 8:
70148 = 7×83+0×82+1×81+4×80= 3584+0+8+4 = 3596
Octal to decimal conversion table
Octal
base 8
Decimal
base 10
0
0
1
1
2
2
3
3
4
4
5
5
6
6
7
7
10
8
11
9
12
10
13
11
14
12
15
13
16
14
17
15
20
16
30
24
40
32
50
40
60
48
70
56
100
64

How to convert from hex to decimal

A regular decimal number is the sum of the digits multiplied with 10n.

Example #1

3B in base 16 is equal to each digit multiplied with its corresponding 16n:
3B16 = 3×161+11×160 = 48+11 = 59

Example #2

E7A9 in base 16 is equal to each digit multiplied with its corresponding 16n:
E7A916 = 14×163+7×162+10×161+9×160 = 57344+1792+160+9 = 59305

Hex to decimal conversion table

Hex
base 16
Decimal
base 10
0
0
1
1
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
A
10
B
11
C
12
D
13
E
14
F
15
10
16
20
32
30
48
40
64
50
80
60
96
70
112
80
128
90
144
A0
160
B0
176
C0
192
D0
208
E0
224
F0
240
100
256
200
512
300
768
400
1024








How to convert decimal to Binary
As we have already seen that a binary number can be converted into decimal number by multiplying the numbers with certain powers of 2, the reverse operation i.e. converting a decimal number into binary number requires certain number of divisions depending upon the character of the number. In this method the decimal number is divided by 2 until the remainder reaches 1 and the dividends are quad up in reverse manner i.e. in the opposite manner of their acquiring beginning from the remainder which is 1. We can show the conversion with the help of an example which will make it easier to understand. Suppose we are converting the decimal number (87)10. Now the conversion is shown below
 
Now if we write side by side from last quotient to first reminder we will get 3454 which is decimal equivalent of natural number three thousand four hundred fifty four.
This is a common technique of converting any natural number to any base system. In above method if we use base 2 in place of base 10, we will get binary equivalent of three thousand four hundred fifty four.
For that we divide 3454 by base 2 and we get 1727 as the quotient and 0 as the remainder.
2
3454
0
Divide again 1727 by 2 and we get 863 as the quotient and 1 as the remainder.
2
1727
1
Divide again 863 by 2 and we get 431 as the quotient and 1 as the remainder.
2
863
1
Divide again 461 by 2 and we get 215 as the quotient and 1 as the remainder.
2
461
1
Divide again 215 by 2 and we get 107 as the quotient and 1 as the remainder.
2
215
1
Divide again 107 by 2 and we get 53 as the quotient and 1 as the remainder.
2
107
1
Divide again 53 by 2 and we get 26 as the quotient and 1 as the remainder.
2
53
1
Divide again 26 by 2 and we get 13 as the quotient and 0 as the remainder.
2
26
0
Divide again 13 by 2 and we get 6 as the quotient and 1 as the remainder.
2
13
1
Divide again 6 by 2 and we get 3 as the quotient and 0 as the remainder.
2
6
0
Divide again 3 by 2 and we get 1 as the quotient and 1 as the remainder
2
3
1
1
For Decimal to binary conversion, we write side by side from last quotient to first reminder we will get 110101111110 which is binary equivalent of natural number three thousand four hundred fifty four.

Decimal to Hexadecimal Conversion


As we have already stated in the previous articles on number systems that all the number systems are inter related, so as the decimal and hexadecimal numbers. Any number in decimal number system can be converted into hexadecimal number system. The procedure is given below. If we try to understand the procedure with an example and step by step then it will be easier and better for us. Let us first take any decimal number suppose we have taken 7510 and now we want to convert it into hexadecimal number, first we have to divide it by 16 75/16= quotient 4, remainder 11 As the quotient is less than 16, we have to stop here and the equivalent hexadecimal number will be 4B8 = 7510 Now we will discuss the method for a slightly bigger number, Suppose the number is 169310 Now we divide it by 16 1693/16 = quotient = 105, remainder = 13(D) Now we have to divide the quotient again by 16 and see the result 105/16 = quotient= 6 remainder = 9 As the quotient is less than 16 the calculation part is completed and we can now directly write the result 169310 = 69D16 So the decimal number has been converted into a hexadecimal number.

From above explanation it can be understood that, hexadecimal number is the summation of products of different digit with their respective multipliers. The multipliers are 160, 161, 162, ........from right hand side or list significant bit(LSB). Let's have an example 4D2 and this would be expressed as 4X162 + DX161 + 2X160 4X162 + 13X161 + 2X160 = 1024 + 208 + 2 = 1234

If we divide decimal 1234 by 16, we will get 77 as quotient and 2 as remainder. Then if we divide decimal 77 by 16, we will get 4 as quotient and 13 or D as remainder. Now if we write side by side from last quotient to first reminder we will get 4D2 which is hexadecimal or hex equivalent of the number 1234.









For that we divide 1234 by base 16 and we get 77 as the quotient and 2 as the remainder.
16
1234
→2
Divide again 77 by 16 and we get 4 as the quotient and 13 or D as the remainder.
16
77
→ D


4



Answer is (4D2)



For information in next post……….

                            Thanks…….

No comments:

Post a Comment