COURSE CODE: 087
CHAPTER NAME: NUMBER SYSTEMS,COMPLIMENTS
UNIT - I
Number Systems - Binary Numbers - Number base conversions - Octal and Hexa Decimal Numbers -
Complements - Signed Binary Numbers - Binary Arithmetic - Binary Codes - Decimal Code
1. Number System
A number system relates quantities and [Link] digital system how information is represented is key
and there are different radices, i.e. number bases, that a numbering system can use.
1.1 Digital computer
Any class of devices capable of solving problems by processing information in discrete [Link] operates on
data,including letters and symbols,that are expressed in binary form i.e using only two digits 0 and 1.
The block diagram of digital computer is given below:
Processor (or)
Control Unit Arithmetic unit
Storage (or)
Memory Unit
Input Output
Devices and Devices and
Control Control
The memory unit stores programs as well as input, output and intermediate data. The processor unit
performs arithmetic and other data processing tasks as specified by the [Link] control unit
supervises the flow of information between various units. The program and data prepared by the user
are transferred into the memory unit by means of an input device such as punch card reader (or) tele
typewriter. An output device, such as printer, receives the result of the computations and the printed
results are presented to the user.
1.2 Number Representation:
It can have different base values like: binary (base-2), octal (base-8), decimal (base 10) and
hexadecimal (base 16),here the base number represents the number of digits used in that numbering
system. As an example, in decimal numbering system the digits used are: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.
Therefore the digits for binary are: 0 and 1, the digits for octal are: 0, 1, 2, 3, 4, 5, 6 and 7. For the
hexadecimal numbering system, base 16, the digits are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
2. Binary numbers
Numbers that contain only two digit 0 and 1 are called Binary Numbers. Each 0 or 1 is called a Bit,
from binary digit. A binary number of 4 bits is called a Nibble. A binary number of 8 bits is called a
Byte. A binary number of 16 bits is called a Word on some systems, on others a 32-bit number is called
a Word while a 16-bit number is called a Halfword.
Using 2 bit 0 and 1 to form
a binary number of 1 bit, numbers are 0 and 1
a binary number of 2 bit, numbers are 00, 01, 10, 11
a binary number of 3 bit, such numbers are 000, 001, 010, 011, 100, 101, 110, 111
a binary number of 4 bit, such numbers are 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000,
1001, 1010, 1011, 1100,1101,1110,1111
Therefore , using n bits there are 2n binary numbers of n bits
Each digit in a binary number has a value or weight. The LSB has a value of 1. The second from the right
has a value of 2, the next 4 , etc.,
16 8 4 2 1
24 23 22 21 20
The binary equivalent for some decimal numbers are given below.
Decimal 0 1 2 3 4 5 6 7 8 9 10 11
Binary 0 1 10 11 100 101 110 111 1000 1001 1010 1011
3. Number Base Conversions
3.1 Conversion of decimal number to any number system
Step 1 convert the integer part by doing successive division using the radix of asked number systems.
Step 2 convert the fractional part by doing successive multiplication using radix of asked number system
3.2 Conversion of decimal to binary number
system The radix of asked number system is 2
Convert 8710 to ( )2
( 1010111)2
Convert (14.625)10 decimal number to binary number
MSB
(1110)2
1st Multiplication Iteration
Multiply 0.625 by 2
0.625 x 2 = 1.25(Product) Fractional part=0.25 Carry=1 (MSB)
2nd Multiplication Iteration
Multiply 0.25 by 2
0.25 x 2 = 0.50(Product) Fractional part = 0.50 Carry = 0
3rd Multiplication Iteration
Multiply 0.50 by 2
0.50 x 2 = 1.00(Product) Fractional part = 1.00 Carry = 1 (LSB)
(101)2
The binary number of (16.625)10 is (1110.101)2
3.3 Conversion of decimal to octal number system
The radix of asked number system is 8
Convert (264)10 decimal number to octal number
(410)8
The octal number of (264)10 is (410)8
Convert (105.589)10 decimal number to octal number
1 MSB
LSB (151)
MSB
LSB ( 0.4554)
The octal number of (105.589)10 is (151.4554)8
3.4 Conversion of decimal to Hexadecimal number system
The radix of asked number system is 16
Convert (1693)10 decimal number to Hexadecimal number
1693/16 = 105 Reminder (13) D (LSB)
105/16 = 6 Reminder 9
6/16 = 0 Reminder 6 (MSB)
(1693)10 (69D)16
Convert (1693.0628)10 decimal fraction to hexadecimal fraction (?)16
1693/16 = 105 Reminder (13) D (LSB)
105/16 = 6 Reminder 9
6/16 = 0 Reminder 6 (MSB)
(69D)
Multiply 0.0628 by 16
0.0628 x 16 = 1.0048(Product) Fractional part=0.0048 Carry=1 (MSB)
Multiply 0.0048 by 16
0.0048 x 16 = 0.0768(Product) Fractional part = 0.0768 Carry = 0
Multiply 0.0768 by 16
0.0768 x 16 = 1.2288(Product) Fractional part = 0.2288 Carry = 1
Multiply 0.2288 by 16
0.2288 x 16 = 3.6608(Product) Fractional part = 0.6608 Carry = 3 (LSB)
(.1013)
(1693.0628)10 = (69D.1013)16
3.5 Conversion of any number system to decimal number system
In general the numbers can be represented as
N= A n-1r n-1 + = A n-2r n-2 +……..+ A1 r1 + A0 r0 + A-1 r-1+ A-2 r-2+………
Where n= number in decimal
A= digit
r= radix of number system
n= The number of digits in the integer portion of number
m= the number of digits in the fractional portion of number
3.6 Conversion of binary to decimal number
system Convert ( 101.101 )2= ( ? )10
101.101
= 1 x 22 + 0 x 21 + 1 x 20 . 1 x 2-1 + 0 x 2-2 + 1 x 2-3
=1x4+0x2+1x1. 1x(1/2)+0x(1/4) +1x(1/8)
= 4+0 +1 . (1/2)+ 0 + (1/8)
= 5 + 0.5 + 0.125
= 5 . 625
Therefore ( 1 0 1 . 1 0 1 )2 = ( 5.625 )10
3.7 Conversion of octal to decimal number system
Convert (128)8= ( ? )10
1238 = 1*82 + 2*81 + 3*80 = 64 + 16 + 3 = 73
the decimal equivalent of the number 123 8 is 7310
Convert (2 1. 2 1)8= (? )10
2 1. 2 1
= 2 x 81 + 1 x 80. 2 x 8-1 + 1 x 8-2
= 2 x 8 + 1 x 1. 2 x ( 1 / 8 ) + 1 x ( 1 / 64 )
= 16 + 1 . (0. 2 5) + (0. 0 1 5 6 2 5)
= 17 + 0. 265625
= 17. 265625
Therefore (2 1. 2 1)8 = (1 7. 2 6 5 6 2 5)10
3.8 Conversion of hexadecimal to decimal number system
Convert (E F. B 1)16= (?)10
= E x 161 + F x 160. B x 16-1 + 1 x 16-2
= 14 x 16 + 15 x 1 . 11 x (1 / 16) + 1 x (1 / 256)
= 224 + 15 + (0. 6 8 7 5) + (0. 0 0 3 9 0 6 2 5)
= 239 + 0. 6914
= 239. 691406
Therefore (E F. B 1)16 = (2 3 9. 6 9 1 4 0 6)10
Convert ( 0.9D9 )16= ( ? )10
= 0 x 160. 9 x 16-1 + D x 16-2 + 9 x 16-3
= 0 x 1. 9 x ( 1 / 16 ) + 13 x ( 1 / 256 ) + 9 x ( 1 / 4096 )
= 0 . (0. 5625) + (0. 050781) + (0. 0021972 )
= 0. (0. 6154782 )
= 0. 6154782
3.9 Conversion of binary to octal number system
Convert (101101001)2 to ( )8
Divide the binary into group of three digits from LSB we will find the following pattern
101|101|001 Now writing the equivalent decimal number of each group we get 5 | 5 | 1 So the
equivalent octal number is 5518
Convert 11001100.101 to ( )8
011|001|100. |101|
3 1 4 .5
So the equivalent octal number is 314.5
3.10 Conversion of binary to hexadecimal number
system Convert 111100010 to ( )16
Divide the binary into group of four digits from LSB
0001|1110|0010
Now writing the equivalent hexadecimal number of each group
1|E|2
So the equivalent Hexa decimal number is 1E216
Convert 11000011001.101 to ( )16
0110|0001|1001|.1010|
6 1 9 . A
So the equivalent Hexa decimal number is 619.A16
3.11 Conversion of octal number system to hexa decimal number system
Convert ( 25)8 to ( )16
First convert octal to binary
The binary equivalent of 25 is 010101
Divide the binary into group of four digits from LSB
0001|0101
1 5
So the equivalent Hexa decimal number is 1516
3.1 Conversion of hexa decimal number system to octal number system
Convert ( 1A.2B)16 to ( )8
First convert hexadecimal to binary
The binary equivalent of 1A.2B is 00011010.00101011
Divide the binary into group of Three digits
011|010|.|001|010|110
3 2 .1 2 6
so the equivalent octal number is 32.1268
4. COMPLEMENTS
It is classified into two types they are 1’s complement , 2’s complement
1’s complement representation: The 1’s complement of a binary number is the number that results
when we change all 1’s to zeros and the zeros to ones.
2’s complement representation:
The 2’s complement is the binary number that results when we add 1 to the 1’s complement.
Problems related to 1’s complement and 2’s complement :
4.1 1’s complement subtraction
Subtraction of binary numbers can be accomplished by the direct method by using the 1’s complement
method, which allows to perform subtraction using only addition . for subtraction of two numbers we have
two cases.
1. Subtraction of smaller number from larger number and
2. Subtraction of larger number from smaller number.
1’s complement Subtraction of smaller number from larger number
Method:
1. Determine the 1’s complement of the smaller number.
2. Add the 1’s complement to the larger number.
3. Remove the carry and add it to the result.
This is called end -around carry.
1’s complement Subtraction of larger number from smaller number
Method:
1. Determine the 1’s complement of the larger number.
2. Add the 1’s complement to the smaller number.
3. Answer is in 1’s complement form. To get the answer in true form take the 1’s complement and
assign negative sign to the answer.
Advantages of 1’s complement subtraction :
1. The 1’s complement subtraction can be accomplished with an binary adder. Therefore , this method
is useful in arithmetic logic circuits.
2. The 1’s complement of a number is easily obtained by inverting each bit in the number.
4.2 2’s complement Subtraction:
Like 1’s complement subtraction, in 2’s complement subtraction, the subtraction is accomplished
by only addition.
2’s complement Subtraction of smaller number from larger number
Method
1. Determine the 2’s complement of the smaller number.
2. Add the 2’s complement to the larger number.
3. Discard the carry.
2’s complement Subtraction of larger number from smaller number
Method:
1. Determine the 2’s complement of the larger number.
2. Add the 2’s complement to the smaller number.
3. Answer is in 2’s complement form. To get the answer in true form take the 2’s complement and
assign negative sign to the answer.