Upload
inderdeep-singh-wilkhu
View
221
Download
0
Embed Size (px)
Citation preview
8/11/2019 Fundamental- Unit 3
1/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 52
Unit 3 Number Systems
Structure
3.0 Introduction
Objectives
3.1 Decimal Number System
3.2 Binary Number System
Binary Addition and Subtraction
Binary Multiplication and Division
3.3 Conversion from Decimal Numbers to Binary
Converting Fractions Decimal Value to Binary
3.4 Negative Numbers
3.5 Representing Negative Numbers Using Complements
Complements in Binary Number System
3.6 Gates
OR Gate
AND Gate
NOT Gate
3.7 Summary
3.8 Terminal Questions
3.9 Answers to Terminal Questions
3.0 Introduction
Any quantity is measured in some system. The quantity measured is
represented in some numbers. There are different number systems. In each
number system, different symbols are used to represent the numbers. The
different number systems are Decimal, Octal, Binary etc.
8/11/2019 Fundamental- Unit 3
2/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 53
Objectives:
After studying this unit you will be able to explain:
Decimal Number System
Binary Number System
Binary Addition and Subtraction
Binary Multiplication And Division
Conversion From Decimal Numbers To Binary
Negative Numbers
Representing Negative Numbers Using Complements
Complements In Binary Number System
Gates: OR, AND, NOT
3.1 Decimal Number System
In this ten symbols are used to represent the numbers and hence it is called
Decimal number system. The ten symbols are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
These are called Arabic numerals.
It is necessary to learn only the 10 basic numerals and the positional
notational system in order to measure any desired quantity or to count any
required figure. After memorizing the addition and multiplication tables and
learning a few simple rules, we can perform all arithmetic operations.
Example-1: Let us represent the quantity 127. The actual meaning of the
number 127 can be seen more clearly if we notice that it is said as one
hundred and twenty seven Basically, the number is a contraction of 1 x 100
+ 2 x 10 + 7. The important point is that the value of each digit is determined
by its position. For example, the 3 in 300 has a different value than the 3 in30. We show this verbally by saying three hundred and thirty different
verbal representations have been invented for numbers from 10 to 20
(eleven, twelve, . .), but from 20 upward we break only at powers of 10
8/11/2019 Fundamental- Unit 3
3/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 54
(hundreds, thousands, lakhs, crores etc.). Written numbers are always
contracted, however, and only the basic 10 numerals are used, regardless
of the size of the integer written.
The base, or radix, of a number system is defined as the number of different
digits which can occur in each position in the number system. The decimal
number system has a base, or radix, of 10. Thus the system has 10 different
digits (0, 1, 2, 3, 4 , 9), any one of which may be used in each position in
a number.
Example-1:
In the decimal system, there are 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8 & 9
These digits can represent any value, for example: 754.
The value is formed by the sum of each digit, multiplied by the base(in this
case it is 10because there are 10 digits in decimal system) in power of digit
position (counting from zero):
Position of each digit is very important! For example, if you place "7" to the
end: 547 it will be another value:
8/11/2019 Fundamental- Unit 3
4/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 55
Important note:Any number in power of zero is 1; even zero in power of
zero is 1:
3.2 Binary Number System
In this number system two symbols are used to represent the numbers and
hence it is called binary number system. The two symbols are 0 and 1. The
same type of positional notation is used in the binary number system as in
the decimal system.
Although the same positional notation system is used, the instead of powers
of 10 as used in decimal number system the binary system uses powers of
2. As was previously explained, the number 127 actually means 1 102+ 2
101+ 7 100. In the binary system, the same number (127) is represented
as 1111111, meaning 1 26+ 1 25+ l 24+123+ l 22+ l 21+ l 20.
3.2.1 Binary Addition and Subtraction
In the same manner as decimal addition is performed, Binary addition is
also carried out.
The table for binary addition is as follows:
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 0 and a carry-over of 1
Carry-overs are performed in the same manner as in decimal arithmetic.
Since 1 is the largest digit in the binary system, any sum greater than 1
requires that a digit be carried over. For example, 010 plus 010 binary
8/11/2019 Fundamental- Unit 3
5/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 56
requires the addition of the two 1s in the second position to the left, with a
carry-over. Since 1 + 1 = 0 plus a carry-over of 1, the sum of 010 and 010 is
100.
Here are three more examples of binary addition:
DECIMAL BINARY DECIMAL BINARY DECIMAL BINARY
6 110 15 1111 31/4 11.01
7 111 20 10100 53/4 101.11
13 1101 35 100011 9 1001.00
It is necessary to establish a procedure for subtracting a larger digit from a
smaller digit in subtraction. The only case in which this occurs with binary
numbers is when 1 is subtracted from 0. The remainder is 1, but it is
necessary to borrow 1 from the next column to the left.
This is the binary subtraction table.
0 0 = 0
1 0 = 1
1 1 = 0
0 1 = 1 with a borrow of 1
A few examples will make the procedure for binary subtraction clear:
DECIMAL BINARY DECIMAL BINARY DECIMAL BINARY
9 1001 16 10000 61/4 110.01
5 101 3 11 41/2 100.1
4 100 13 1101 13/4 1.11
3.2.2 Binary Multiplication and Division
Binary Multiplication:
The table for binary multiplication is also given below:0 x 0 = 0
1 x 0 = 0
0 x 1 = 0
1 x 1 = 1
8/11/2019 Fundamental- Unit 3
6/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 57
The following examples of binary multiplication show the simplicity of each
operation. It is only necessary to copy the multiplicand if the digit in the
multiplier is 1 and to copy all 0s if the digit in the multiplier is a 0.
The following two examples of binary multiplication illustrate the simplicity of
each operation. If the digit in the multiplier is 1 then copy multiplicand and
copy all 0s if the digit in the multiplier is a 0.
DECIMAL BINARY DECIMAL BINARY
09 1001 1.25 1.01
x 10 x 1010 x 2.5 x 10.1
90 0000 625 101
1001 250 1010
0000 3.125 11.001
1001
1011010
Binary Division:
Binary division is, like any number system is very simple.
0 1 = 0
1 1 = 1
Note:Division by zero is not done in any number system.
Following are the examples of division:
Example 1:
DECIMAL BINARY
5 101
5) 20 101) 11001
101
101
101
8/11/2019 Fundamental- Unit 3
7/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 58
Example 2:
DECIMAL BINARY
2.416... 10.011010101...
12)29.0000 1100)11101.00
24 1100
50 10100
48 1100
20 10000
12 1100
80 1000072 1100
8 ...
To convert the quotient obtained in the second example from binary to
decimal, we would proceed as follows:
10.011010101 = 1 x 21 = 2.0
0 x 20 = 0.0
0 x 21 = 0.0
1 x 22 = 0.25
1 x 23 = 0.125
0 x 24 = 0.0
1 x 25 = 0.03125
0 x 26 = 0.0
1 x 27 = 0.0078125
0 x 28 = 0.00
1 x 29 = 0.001953125
2.416015625
Therefore, 10.011010101 binary equals approximately 2.416 decimal.
8/11/2019 Fundamental- Unit 3
8/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 59
3.3 Conversion from Decimal Numbers to Binary
Many methods are available for converting a decimal number to a binary
number.
In the first method simply subtract all powers of 2, which can be subtracted
from the decimal number until nothing remains. The highest power of 2 is
subtracted first, then the second highest, etc.
8/11/2019 Fundamental- Unit 3
9/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 60
8/11/2019 Fundamental- Unit 3
10/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 61
A good way to organize this conversion is to list the divisions in table
form as below:
Reading from bottom to top, the final answer is 10112. Remember that thefirst division gives us the least significant digit of our answer, and the final
division gives us the most significant digit of our answer. Also, the result of
the final division is always 0.
3.3.1 Converting Fractions Decimal Value to Binary
When converting a fractional decimal value to binary, we need to use a
slightly different approach. Instead of dividing by 2, we repeatedly multiply
the decimal fraction by 2. If the result is greater than or equal to 1, we add a
1 to our answer. If the result is less than 1, we add a 0 to our answer.
8/11/2019 Fundamental- Unit 3
11/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 62
8/11/2019 Fundamental- Unit 3
12/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 63
3.4 Negative Numbers
For writing negative numbers a standard convention is adopted and it
consists of placing a sign symbol before a number that is negative. For
example, negative 27 is written as -27. If 27 is to be added to + 45, we
write
+ 45 + (27) = 18
But if a negative number is subtracted from a positive number, for example
the above expression can be written as +45(27) = + 45 + 27 = 72 (- andbecomes +).
In binary machines each of the binary digit is represented by a switch which
can be used to represent two values but one at a time either ON or OFF.
8/11/2019 Fundamental- Unit 3
13/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 64
As an example, given a set of six switches, any number from 000000 to
111111 may be represented by the switches if we define a switch with its
contacts closed as representing a 1 and a switch with open contacts as
representing a 0. If we desire to increase the total range of numbers that we
can represent so that it will include the negative numbers from 000000 to
111111, another bit (or switch) will be required. We then treat this bit as a
sign bit and place it before the magnitude of the number to be represented.
The convention adopted generally is that when the sign bit is a 0, the
number represented is positive, and when the sign bit is a 1, the number is
negative. Let us consider the previous example where we have used six
switches to represent the quantity and now to specify the sign of the quantity
whether positive or negative one more switch will have to be used. When
the contacts of this seventh switch are open, the number will be a positive
number equal to the magnitude of the number stored in the other six
switches; and if the switch for the sign bit is closed, the number represented
by the seven switches will be a negative number with a magnitude
determined by other six switches.
Let us consider the following example when seven switches are used.
37 = 1100101
The seventh switch represents the negative sign, which is 1.
+37 = 0100101
The seventh switch represents the positive sign, which is 0.
3.5 Representing Negative Numbers Using Complements
The negative numbers can be represented in complement form so that a
machine can be made to add and subtract, using only circuitry for adding.
3.5.1 Complements in Binary Number System
There are two types of complements in this and they are 2s complement
and 1s complement.
8/11/2019 Fundamental- Unit 3
14/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 65
The 2s complement of a binary number is formed by simply subtracting
each bit of the number from the radix minus one and adding a 1 to the least
significant bit. Since the radix in the binary number system is 2, each bit of
the binary number is subtracted from 1. The application of this rule is
actually very simple; every 1 in the number is changed to a 0 and every 0 to
a 1. Then a 1 is added to the least significant bit of the number formed. The
2s complement of 10110 is formed by the following steps:
Step 1:Change 1 bit to 0 and vice versa so 01001
Step 2:Add 1 to the Least significant bit so 01001 +
1
01010
So the 2s complement of 10010 is 01010.
Similarly the 2s complement of 10010 is 01110. Subtraction using the 2s
complement system involves forming the 2s complement of the subtrahend
and then adding this complement to the minuend. For instance,
Example 1:
11001 11001
10100 = + 01100
00101 1 00101
Carry is dropped
Example 2
10110 10110
01110 = + 10010
01000 1 01000
Carry is dropped
8/11/2019 Fundamental- Unit 3
15/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 66
Subtraction using the 1s complement system is also straightforward. The
1s complement of a binary number is formed by changing each 1 in the
number to a 0 and each 0 in the number to a 1. For instance, the 1s
complement of 11101 is 00010, and the 1s complement of 00011 is 11100.
When subtraction is performed in the 1s complement system, any end-
around carry is added to the least significant bit. For instance,
Example 1:
11001 11001
10100 = + 01011
00101 00100
1 Carry generated is added
00101
Example 2
10110 10110
01110 = + 10001
01000 00111
1 Carry generated is added
01000
Note:Observe the difference in 2s and 1s complement subtraction for the
same quantity.
3.6 Gates
A gate is an electronic circuit which operates on one or more input signal to
produce an output signal. There are different gates like OR, AND, NOT etc.
8/11/2019 Fundamental- Unit 3
16/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 67
3.6.1 OR Gate:
The following table gives the combinations of input and the output for each
of the combinations. This table is also called as truth table of OR gate.
Inputs
X Y
Output
Z
0 0 0
1 0 1
0 1 1
1 1 1
In the above table X and Y are the Inputs and Z is the Output. As shown in
the table when both the Inputs are 0, then the Output is 0. If any one of the
Input or both the Inputs are 1, then the Output is 1.
Logical addition table:
0 + 0 0
0 + 1 1
1 + 0 1
1 + 1 1
ORgate is used to realize the logical addition operation.
3.6.2 AND Gate:
The following table gives the combinations of input and the output for each
of the combinations. This table is also called truth table AND gate.
8/11/2019 Fundamental- Unit 3
17/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 68
Inputs
X Y
Output
Z0 0 0
1 0 0
0 1 0
1 1 1
In the above table, X and Y are the Inputs and Z is the Output. As shown in
the above table, the Output is 1 only when both the Inputs are 1 and in all
other cases the output is 0.
Logical multiplication table:
0 . 0 0
0 . 1 0
1 . 0 0
1 . 1 1
AND gate is used to realize the logical multiplication operation
3.6.3 NOT Gate
Singular or unary operations define an operation on a single variable. The
familiar example of unary operation is -, so we can write -7, -9 or Z, that
means we are to take the negative of these values. The operation
complementation means inversion of a quantity and this operation is defined
by the following table.
InputX
OutputZ
0 1
1 0
8/11/2019 Fundamental- Unit 3
18/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 69
The above table gives the output for each input. This table is also called
truth table NOT gate. The operation complementation or inversion of a
quantity can be realized by the help of NOT gate.
3.7 Summary
In Binary number system two symbols are used to represent the numbers
and hence it is called binary number system.
The two symbols are 0 and 1.
The same type of positional notation is used in the binary number system as
in the decimal system. In the same manner as decimal arithmetic is
performed, Binary addition, subtraction, multiplication and division is also
carried out. The negative numbers are represented in complement form so
that a machine can be made to add and subtract, using only circuitry for
adding. There are two types of complements in this and they are 2s
complement and 1s complement.
A gate is an electronic circuit which operates on one or more input signal to
produce an output signal. There are different gates like OR, AND, NOT etc.
Self Assessment Questions
1. Symbols are used to represent the numbers and it is called as
__________
2. For example, negative 27 is written as -27. If 27 is to be added to 45,
we denote as _____________
3. In decimal system, there are 10 digits. (True/False)
4. Carry-over is performed in the same manner as in decimal arithmetic.
(True/False)
8/11/2019 Fundamental- Unit 3
19/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 70
Answers to Self Assessment Questions
1. Decimal number system
2. + 45 + (27) = 18
3. True
4. True
3.8 Terminal Questions
1. What is Decimal number system?
2. How do you convert Fractional Decimal value to Binary Numbers?
3. Convert the following from Binary to Decimal:
a) 11111
b) 10110
c) 11001
d) 00101
4) Perform the following Arithmetic operations in Binary
a) 11011 + 11110
b) 11.01 + 101.11c) 11101100
d) 10010101
e) 1011 * 110
f) 111* 101
g) 1111 111
h) 111 11
5) Perform the following subtraction using 1s and 2s complement system
a) 1110111110b) 11001 10011
6) Write the truth table of OR, AND, NOT gates.
8/11/2019 Fundamental- Unit 3
20/20
Fundamentals of Information Technology Unit 3
Sikkim Manipal UniversityDDE Page No. 71
3.9 Answers to Terminal Questions
1. Refer section 3.1
2. Refer section 3.3.1
3. Refer section 3.2
4. Refer section 3.1
5. Refer section 3.5
6. Refer section 3.6.1, 3.6.2 & 3.6.3