Number System
CP
Why Number System
Binary numbers
All computers work with 0’s and 1’s so it is like learning alphabets before learning
English
Base conversion
For convenience, people use other bases (like decimal, hexdecimal) and we need to
know how to convert from one to another.
Number systems
There are more than one way to express a number in binary. So 1010 could be -2, -
5 or -6 and need to know which one.
Why Number System
Bases we will use
Binary: Base 2
Octal: Base 8
Decimal: Base 10
Hexadecimal: Base 16
Positional number system (converting to base 10 i.e. decimal no)
1012= 1×22 + 0×21 + 1×20
638 = 6×81 + 3×80
A116= 10×161 + 1×160
Conversion
Conversion from binary to octal/hex
Binary: 10011110001
Octal: 10 | 011 | 110 | 001=23618
Hex: 100 | 1111 | 0001=4F116
Conversion from binary to decimal
1012= 1×22 + 0×21 + 1×20 = 510
63.48 = 6×81 + 3×80 + 4×8–1 = 51.510
A116= 10×161 + 1×160 = 16110
Conversion (Binary to Decimal)
➢ Take each digit in the binary number and multiply it with its place value.
➢ The sum of all the above products will give the equivalent decimal number.
Ex :- (1011)2 to decimal number.
Sol :- (1011)2 = (1 x 23) + ( 0 x 22) + (1 x 21) + (1 x 20 )
= (1 x 8) + ( 0 x 4) + (1 x 2) + (1 x 1)
= (11)10
Conversion (Binary to Decimal)
For the fraction (after the decimal point) the place value starts with
negative power of 2. This negative power value increases from left to right.
• The place value of the first left digit in fraction is (2–1)
• The place value of the next right digit in fraction is (2–2)
• The place value of the next right digit in fraction is (2–3) ……. so on
Conversion (Binary to Decimal)
Ex :- Convert the binary number (0.1101)2 into decimal number.
1 1 1 1
(0.1101)2 = (1 x ) + ( 1 x ) + (0 x ) + (1 x )
2 4 8 16
= 1 x 0.5 + 1 x 0.25 + 0 x 0.125 +1 x 0.0625
= 0.5 +0.25 + 0 + 0.0625
= (0.8125)10
Conversion (Binary to Decimal)
Ex :- Convert the binary number (1010.0101)2 into decimal number.
Sol :- Integer part (1010)2 = (1 x 23) + ( 0 x 22) + (1 x 21) + (0 x 20 )
= (1 x 8) + ( 0 x 4) + (1 x 2) + (0 x 1 )
= (10)10
Fractional part (0.0101)2 = (0 x 2–1) + ( 1 x 2–2) + (0 x 2–3) + (1 x 2–4)
1 1 1 1
= (0 x ) + ( 1 x ) + (0 x ) + (1 x )
2 4 8 16
= 0 x 0.5 + 1 x 0.25 + 0 x 0.125 +1 x 0.0625
= 0 + 0.25 + 0 + 0.0625
= (0.3125)10
Conversion (Binary to Decimal)
Ex :- Convert the binary number (1010.0101)2 into decimal number.
Sol :- Integer part (1010)2 = (1 x 23) + ( 0 x 22) + (1 x 21) + (0 x 20 )
= (1 x 8) + ( 0 x 4) + (1 x 2) + (0 x 1 )
= (10)10
Fractional part (0.0101)2 = (0 x 2–1) + ( 1 x 2–2) + (0 x 2–3) + (1 x 2–4)
1 1 1 1
= (0 x ) + ( 1 x ) + (0 x ) + (1 x )
2 4 8 16
= 0 x 0.5 + 1 x 0.25 + 0 x 0.125 +1 x 0.0625
= 0 + 0.25 + 0 + 0.0625
= (0.3125)10
Binary to Octal number system
Ex :- Convert the binary number (1110101)2 into octal number.
(1110101)2 = 001 110 101
= (165)8
Binary to Hexadecimal number system
Ex :- Convert the binary number (1010101010)2 in to hexadecimal number.
(1010101010)2 = 0010 1010 1010
= (2AA)16
Decimal to Binary conversion
The decimal number is converted in to binary number by using successive divisions
method.
1. The decimal number (i.e. dividend) is divided by 2 (i.e. divisor).
2. If ‘1’ or “0” occurs as remainder, transfer that ‘1’ or “0” to the binary record.
3. Now take quotient as dividend and divide it by 2 and transfer the remainder to the
binary record.
4. The same procedure is continued until the quotient becomes zero
5. The last remainder is taken as most significant bit (MSB).
6. The first remainder is taken as least significant bit (LSB).
7. The equivalent binary number comprises with all the remainders in successive
divisions method in the order from MSB (bottom) to LSB (top).
Fractional Decimal number to binary
The fractional decimal number is converted in to binary number by using successive
fraction multiplications method.
1. The fractional decimal number is multiplied with 2 by successive fraction multiplications
method.
2. If ‘1’ or ‘0’ occurs in units place in the product, transfer that ‘1’ or ‘0’ to the binary record.
3. The multiplication is continued with the remaining fraction.
4. The same procedure is followed in each multiplication.
5. The first transferred number (1 or 0) to binary record is taken as most significant bit (MSB).
6. The last transferred number (1 or 0) to binary record is taken as least significant bit (LSB).
7. If the multiplication does not end, it can be stopped at any of our desired level.
Decimal to Hexadecimal Conversion
Ex :- Convert the decimal number (415)10 in to hexadecimal number.
Hexadecimal to Decimal Conversion
Ex: (5C7)16 to decimal
Sol:- (5C7)16 = (5x162) + (C x161) + (7 x160)
= 1280 + 192 + 7
= (1479)10
Convert hexadecimal number 1F.01B into decimal number.
Since value of Symbols: B and F are 11 and 15 respectively. Therefore
equivalent decimal number is
= (1F.01B)16
1 0 -1 -2 -3
= (1x16 +15x16 +0x16 +1x16 +11x16 )10
= (31.0065918)10 which is answer.