Number base conversion
Number system
Definition
Before understand the conversion first learn about “Number system” – A technique that is used to represent the numbers in computer architecture is known as number system. Every value that is store in computer memory is defining number system. A computer store data in the form of bits or digits that the human cannot read data easily that’s why computer require inputs and outputs interface. The computer store bits or digits in the coded form. Now to understanding these codes we firstly understand the number system.
There are four type of number system
1) Binary number system
2) Decimal number system
3) Octal number system
4) Hexadecimal number system
-
Binary number system:
In number system, the digits with base 2 are known as binary number system. In binary number system we use only two digits: zero (0) and one (1). Every numbers used in binary number system with base 2.
Example: (010101)2 -
Decimal number system:
In number system, the digits with base 10 are known as decimal number system. In decimal number system we use digits from 0 to 9. Every numbers used in decimal number system with base 10.
Example: (765849)10 -
Octal number system:
In number system, the digits with base 8 are known as octal number system. In octal number system we use digits from 0 to 7. Every numbers used in decimal number system with base 8.
Example: (2346710)8 -
Hexadecimal number system:
In number system, the digits with base 16 are known as hexadecimal system. In hexadecimal number the first 10 digits are same as the decimal number system 0 to 9 and remaining six digits are the symbol A, B, C, D, E, and F that represent decimal value 10, 11, 12, 13 ,14 and 15 respectively. Every numbers used in decimal number system with base 16.
Example: (D45F70A)16
Conversion of number system
The computers only understand the binary number system but human cannot understand binary number system so we use conversion to understand the number systems. We use many number of methods to convert numbers in other base. These methods are discussed below.
-
Conversion from another base to decimal
We use some steps to convert other base to base 10 (decimal number).
1) Firstly we know the position of digits.
2) Multiply the right most value or number with 2^0 than move to left side and increase the power of 2.
3) Calculate the sum to these digits. The result of this sum is equal to decimal number.
-
Conversion binary to decimal
Example: (11001)2
(1x(2^4))+(1x(2^3))+(0x(2^2))+(0x(2^1))+(1x(2^0))
16+8+0+0+1 = (25)10
Example: (1001001)2
(1x(2^6))+(0x(2^5))+(0x(2^4))+(1x(2^3))+(0x(2^2))+(0x(2^1))+(1x(2^0)
64+0+0+8+0+0+1 = (73)10
-
Conversion octal to decimal
Example: (2314)8
(2x(2^3))+(3x(2^2))+(1x(2^1))+(4x(2^0))
16+12+2+4 = (34)10
Example: (43271)8
(4x(2^4))+(3x(2^3))+(2x(2^2))+(7x(2^1))+(1x(2^0))
64+24+8+14+1 = (111)10
-
Conversion hexadecimal to decimal
Example: (A23F)16
(Ax(2^3))+(2x(2^2))+(3x(2^1))+(Fx(2^0))
80+8+6+15 = (109)10
Example: (D4C3)16
(Dx(2^3))+(4x(2^2))+(Cx(2^1))+(3x(2^0))
104+16+24+3 = (147)10
-
Conversion from decimal to another form
Converting decimal to other base we use some steps that are given below:
1) Firstly we divide the decimal number by the value of the new base.
2) Record the reminder of numbers.( the right most digit of the new number)
3) Divide the quotient of the previous division by the new base.
4) Record the reminder of number (the next digit of the new base number).
Conversion decimal to binary
4210
Hence 4210 = 01010102
Conversion decimal to octal
95210
Hence 95210 = 16708
Conversion decimal to hexadecimal
42810
Hence 42810 = 1AC16
Conversion of binary to hexadecimal
Using steps to converting binary to hexadecimal
1) Converting binary digits to decimal digits
2) Converting decimal to hexadecimal digits.
Example: 110100112 =? 16
Step 1: convert 110100112 to base 10
110100112
=(1x(2^7))+(1x(2^6))+(0x(2^5))+(1x(2^4))+(0x(2^3))+(0x(2^2))+(1x(2^1))+(1x(2^0))
=1×128+1×64+0x32+1×16+0x8+0x4+1×2+1×1
=128+64+0+16+0+0+2+1
=21110
Step 2: convert 21110 to base 16
Therefore, 110100112 = 21110 = D316
Hence 110100112 = D316
Conversion octal to binary
We follow 2 steps to converting digits octal to binary:
1) Firstly we converting each octal digit to a 3 binary number
2) Than combining each result of binary digits into a single binary numbers.
Example: 5628
Step 1: convert each octal digits to 3 binary digits
58 = 1012
68 = 1102
28 = 0102
Step 2: combining each result of binary number
5628 = 1011100102
Example: 67518
67518 = 110 111 101 001
110 = 6
111 = 7
101 = 5
001 = 1
=1101111010012
Hence 67518 = 1101111010012
Conversion hexadecimal to binary
We follow three steps
1) Firstly converting hexadecimal digits to decimal digits
2) Than converting decimal digits to binary digits (group of four).
3) Combine each result of binary numbers
Example: 2AB16
Step 1: converting hexadecimal digits to decimal digits
216 = 210
A16 = 1010
B16 = 1110
Step 2: converting decimal digits to binary numbers
210 = 00102
1010 = 10102
1110 = 10112
Step 3: combining each result
0010101010112
Example: ABC16
A = 10102
B = 10112
C = 11002
Hence, ABC16 = 1010101111002
Conversion binary to octal
Using two steps to converting binary to octal
1) Divide each binary digits into group of three
2) Convert each group of three binary digit into octal one octal digit
3) combining
Example: 1011102
Step 1: divide the binary digit into group of 3
101 110
Step 2: convert each group into one octal
#1012
= (1x(2^2))+(0x(2^1))+(1x(2^0))
=4+0+1
=58
#1102
=(1x(2^2))+(1x(2^1))+(0x(2^0))
=4+2+0
=68
Hence 1011102 = 568