Number system
• A number system is defined as a system of writing for expressing
numbers.
• Number system refers to the digits, its arrangements, positional value
and base of number system.
• The total number of digits used in a particular number system is called
base of that number system
• There are basically four types of number system:
1. Binary number system
2. Digital number system
3. Octal number system
4. Hexadecimal number system
Binary Number System
• A number system having base or radix 2 is called binary number
system.
• It only contains two digits 0 (off) and 1 (on).
• It is specially used in internal processing of computer system.
• All binary numbers are formed using combination of 0 and 1.
• For example, (101011)2 , (1010)2 , (11101)2, etc.
Digital Number System
• A number system having base or radix 10 is called binary number
system.
• It consists of 10 digits—0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.
• It is specially used in computer interface.
• For example: (1234)10, (4341)10, (10123)10, etc.
Octal Number System
• A number system having base or radix 8 is called binary number
system.
• It consists of 8 digits: 0, 1, 2, 3, 4, 5, 6 and 7.
• It is also used in internal processing of computer systems.
• For example: (256)8, (712)8, (37623)8 , etc.
Hexadecimal Number System
• A number system having base or radix 16 is called binary number
system.
• It consists of sixteen digits—0 to 9, A, B, C, D, E, F, where (A is for 10, B
is for 11, C-12, D-13, E-14, F-15).
• It is also used in computer basically in memory management.
• All hexadecimal numbers are represented using these 16 digits. For
example: (3FA)16, (87B)16, (113) 16, etc.
Importance of number system
• It helps to understand how the data are represented before they can
be processed by any digital systems, including a digital computer.
• It helps to understand how the computer performs basic operations
as addition/subtraction in binary.
• It helps us to understand the conversion of data among the four
number system.
Number System Conversion
1. Binary to other number system.
2. Decimal to other number system.
3. Octal to other number system.
4. Hexadecimal to other number system.
1. Binary to other number system
• Binary to Decimal Conversion:
• Conversion is done by calculating sum of product of each binary digit
and its corresponding place value( in terms of power of 2 which
begins from 0 and increases for integer part and from -1 and
decreases for fraction part)
• EG
• 1110012 = 1x25+1x24+1x23+0x22+0x21+1x20 = 5710
• 1000112 = 1x25+0x24+0x23+0x22+1x21+1x20 = 3510
• Binary to Octal Conversion :
1. Partition the binary number in groups of three bits, starting from the
right-most side.
2. For each group of three bits, find its octal number.
3. The result is the number formed by the combination of the octal numbers
• Eg: to convert 1110101100110 to octal
• 001 110 101 100 110
1 6 5 4 6
The octal number is (16546)8.
• Binary to Hexadecimal Conversion :
1. Partition the binary number in groups of four bits, starting from the right-most
side.
2. For each group of four bits, find its hexadecimal number.
3. The result is the number formed by the combination of the hexadecimal
numbers
Eg: to convert 1110101100110 to hexadecimal
• 0001 1101 0110 0110
1 D 6 6
The hexadecimal number is (1D66)16 .
Decimal to other number system
• Decimal to Binary Conversion :
• Divide the decimal number by 2 and after each division note the
remainder on the side.
• When division is complete, note the remainders from bottom to top
which is binary number.
Convert 25 from Base 10 to Base 2
Convert 23 from Base 10 to Base 2
• Decimal to Octal Conversion:
• Divide the decimal number by 8 and after each division note the
remainder on the side.
• When division is complete, note the remainders from bottom to top
which is binary number.
Convert 23 from Base 10 to Base 8
: Convert 147 from Base 10 to Base 8
Convert 0.865 from Base 10 to Base 2,8 and 16.
• Decimal to Hexadecimal Conversion :
• Divide the decimal number by 16 and after each division note the
remainder on the side.
• When division is complete, note the remainders from bottom to top
which is binary number.
Convert 23 from Base 10 to Base 16 Convert 147 from Base 10 to Base 16
: Convert 34.4674 from Base 10 to Base 16.
Convert 0.865 from Base 10 to Base 16.
Octal to other number system
• Octal to Binary Conversion
1. Convert each octal number into a three-digit binary number.
2. The result is the number formed by the combination of all the bits
Convert the octal number 473 to binary.
3. Given number is 473
4. Convert each octal digit into three digit binary number.
3. Combine all the bits to get the result 100111011.
• Octal to Decimal Conversion
• Conversion is done by calculating sum of product of each binary digit
and its corresponding place value( in terms of power of 2 which
begins from 0 and increases for integer part and from -1 and
decreases for fraction part)
Convert .345 from Base 8 to Base 10. Convert .345 from Base 8 to Base 10.
• Octal to Hexadecimal Conversion
1. Convert each octal number into a three-digit binary number.
2. Group together four digit binary number from right to left.
3. Write corresponding hexadecimal number for grouped four bit
binary number.
4. The result is the number formed by the combination of all
converted bits.
Convert: (567)8 = (?)16
1. Convert octal numbers to 3 digit binary numbers.
Octal Digits : 5 6 7
Binary Digits: 101 110 111
2. Group four binary bits from right to left.
Binary Digits: 0001 0111 0111
Hexadecimal: 1 7 7
=(177)16
So, (567)8 = (177)16
Convert: (123.456)8 = (?)16
1. Convert octal numbers to 3 digit binary numbers.
Octal Digits : 1 2 3 4 5 6
Binary Digits: 001 010 011 100 101 110
2. Group four binary bits from right to left.
Binary Digits: 0101 0011 1001 0111 0000
Hexadecimal: 5 3 9 7 0
=(53.97)16
So, (123.456)8 = (53.97)16
Hexadecimal to other number system
• Hexadecimal to binary conversion
1. Convert each hexadecimal number into a four-digit binary number.
2. The result is the number formed by the combination of all the bits.
Convert the hexadecimal number 2BA3 to binary.
3. Given number is 2BA3
4. Convert each hexadecimal digit into four digit binary number.
Combine all the bits to get the result 0010101110100011.
• Hexadecimal to Decimal Conversion:
• Conversion is done by calculating sum of product of each binary digit
and its corresponding place value( in terms of power of 2 which
begins from 0 and increases for integer part and from -1 and
decreases for fraction part)
Convert C15 from Base 16 to Base 10 Convert .15 from Base 16 to Base 10.
• Hexadecimal to Octal Conversion
1. Convert each octal number into a four-digit binary number.
2. Group together three digit binary number from right to left.
3. Write corresponding octal number for grouped four bit binary
number.
4. The result is the number formed by the combination of all
converted bits.
Convert: (5E7)16 = (?)8
1. Convert hexadecimal numbers to 4 digit binary numbers.
Hexadecimal : 5 E 7
Binary Digits : 0101 1110 0111
2. Group four binary bits from right to left.
Binary Digits: 010 111 100 111
Octal : 2 7 4 7
=(2747)8
So, (5E7)16 = (2747)8
Convert: (5E7.3D)16 = (?)8
1. Convert hexadecimal numbers to 4 digit binary numbers.
Hexadecimal : 5 E 7 3 D
Binary Digits : 0101 1110 0111 0011 1101
2. Group four binary bits from right to left.
Binary Digits: 010 111 100 111 001 111 101
Octal : 2 7 4 7 1 7 5
=(2747.175)8
So, (5E7.3D)16 = (2747.175)8
Complements: r’s and (r-1)’s
1. (r-1)’s complement:
It is also known as 1’s complement.
A 1’s complement of a given binary number is obtained by subtracting
each bit of the given number from 1.
In other words, it is obtained by inverting 0 to 1 and 1 to 0.
For example: 1’s complement of 101 is 010, 11010 is 00101, etc.
2. r’s complement
It is also known as 2’s complement.
It is obtained by adding 1 to the 1’s complement of the given binary
number.
For example: 2’s complement of 101 is 010+1=011
- 110101 is 001010 +1=001011
Steps for binary subtraction using 1’s(r-1)’s
complement.
• Make the number of bits equal in both subtrahend and minuend
• Calculate 1’s complement of subtrahend.
• Calculate sum of minuend and 1’s complement of subtrahend.
• Check the carry.
- If there is carry, discard it and add it to the remaining part of the sum.
- If there is no carry, then the result must be –ve. So, again calculate 1’s
complement of the sum.
Examples
• 1010-101 • 101 – 1010
• Make the number of bits equal: • Making bits equal: 0101 and 1010
1010 and 0101 • 1’s complement of 1010 is 0101
• 1’s complement of 0101 is 1010 • Add: 0101
• Add both the bits: 1010 +0101
+1010 1010
10100 • Since there’s no carry, 1’s
• add the carry: 0100+1=0101 complement of sum 1010 is 0101
• Ans: 0101 • Ans: -0101
Steps for binary subtraction using 2’s(r’s)
complement.
• Make the number of bits equal in both minuend and subtrahend.
• Calculate 2’s complement of subtrahend.
• Calculate sum of minuend and 2’s complement of subtrahend.
• Check the carry.
- - If there is carry, discard it.
- If there is no carry, then the result must be –ve. So, again calculate 2’s
complement of the sum.
Examples:
• 1010-101 • 101 – 1010
• Make the number of bits equal: • Making bits equal: 0101 and 1010
1010 and 0101 • 2’s complement of 1010 is
• 2’s complement of 0101 is 0101+1=0110
1010+1=1011 • Add: 0101
• Add both the bits: 1010 +0110
+1011 1011
10101 • Since there’s no carry, 2’s complement
• Discard the carry: 0101 of sum 1011 is 0100+1=0101
• Ans: 0101 • Ans: -0101