Number System
Number System
1.1 Introduction
The number system is a collection of number to represent the quantifiable
information. Most of the computations in the number systems are addition,
subtraction, multiplication, division, etc. we usually perform all calculation
using the decimal number system.
In decimal number system we have ten different digits or symbols i.e. 0, 1, 2,
3, 4, 5, 6, 7, 8 and 9. The combination of this number gives quantifiable
values. To represent these values in the electronics world, we don’t have the
hardware, so there was need for the hardware which can represent the any
one number system. The invention of transistor, have triggered the engineers
to make use of the binary number system. The binary numbers system have
only two values i.e., 0, 1. With the help of the transistor we can represent the
two states (0, 1) of the number.
The invention of transistor made a remarkable change in the electronic world
especially in computer science. The transistor acted as a switch, able to
represent the binary number. In computer, the computations are not carried
similar to the normal day to day computation. Enormous numbers of
algorithms are developed to carry out the computation operations.
lOMoARcPSD|34342310
The number position always starts from Zero. Here if you observe 7
is in 0th position it give value 7
6 is in 1st position it gives value 60
Example 1.4: How do you represent the binary value 1010.101 in decimal
format?
1 x 23 + 0 x 22 + 1 x 21 + 0 x 20. 1 x 2-1 + 0 x 2-2 + 1 x 2-3
Example 1.5: How do to represent the octal value “1760” in decimal format?
1 x 83 + 7 x 8 2 + 6 x 8 1 + 0 x 8 0
decimal representation is
number is negative or positive. The MSB “0” represent the positive value and
MSB “1” represent the negative value.
The range for this representation is: - 2n-1 -1 to + 2n-1 -1
The drawbacks of this representation are: It has both positive and negative
zero, and complex architecture required for computation.
1.6.2 1’s Complement
The 1’s complement is slightly different from the signed magnitude number.
All binary bits are complemented and represented along with the sign bit. As
shown in table 1.4
The range function for this representation is: - 2n-1 -1 to + 2n-1 -1
The drawbacks of this representation are: It has both positive and negative
zero and complex architecture required for computation.
1.6.3 2’s Complement
The 2’s Complement is asymmetric system with additional bit is required to
represent any numbers. The binary bits are complemented and added 1
with it.The range function for this representation is: - 2 n-1 to + 2n-1 -1.The
addition and subtraction can be performed using same hardware. The table
1.4 shows the comparison of negative number systems.
Table 1.4: Comparisons of Negative Number Systems
Signed 1’s 2’s
Decimal
Magnitude Complement Complement
-8 – – 1000
-7 1111 1000 1001
-6 1110 1001 1010
-5 1101 1010 1011
-4 1100 1011 1100
-3 1011 1100 1101
-2 1010 1101 1110
-1 1001 1110 1111
-0 1000 1111 –
+0 0000 0000 0000
+1 0001 0001 0001
+2 0010 0010 0010
+3 0011 0011 0011
So far we have studied the decimal number to other number system without
fraction. Now we will concentrate on the fractional conversion.
The fractional decimal number must be multiplied by the base of the other
number system to convert it into other number systems as shown in example
1.10. For example decimal number is to be converted into the binary.
Fractional part has to be multiplied by 2 repeatedly till we will make the
fractional part zero. If the fractional part goes on and on, we can terminate in
between.
lOMoARcPSD|34342310
Example 1.10: How to convert 100.26510 into binary, octal and hexadecimal?
Let us take the integer part first and convert it to other number systems.
Now for the fractional part, we follow the multiplication process as shown
below:
Therefore,
100.26510= (1100100.0100)2 ; 100.26510=(144.20753)8 ;
100.26510= (64.43D70)16
Now before we convert number from octal to binary and vice versa, one has
to know the equivalent numbers for both the systems. The table 1.5 shows
the octal numbers with its equivalent the binary numbers.
Table 1.5: Octal numbers with equivalent binary number formats
Octal Binary
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
From the table 1.5, it is clear that any octal digit can be represented by a
group of three binary digits (or Bits)
To covert any hexadecimal number to binary and vice versa, refer the table
1.6 which shows the binary equivalent for the hexadecimal numbers. The
table 1.6 also gives the comparison of all the four number systems
Table 1.6: Comparison of decimal values with other number formats
Decimal Binary Octal Hexadecimal
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
From the table 1.6, it is clear that any hexadecimal digit can be represented
by a group of four binary digits (or Bits)
Example 1.11: Convert the 61358 into binary value
lOMoARcPSD|34342310
In this example, we can replace all independent value into equivalent 3-bit
binary value as shown below to get our answer.
6 1 3 58
110 001 011 1012
Example 1.12: Convert (6135.2478)8 into binary value
Similar with the example 1.11, here we will replace equivalent 3 bit binary
value to represent the octal value.
6 1 3 5 . 2 4 78 110
001 011 101 . 010 100 1112
Example 1.13: Convert 1A2C16 into Binary Value.
In this example, we can replace all independent value into 4-bit binary
equivalent as shown below to get our answer.
1 A 2 C16
0001 1010 0010 11002
It is worth noting that the use of the 1's complement in the binary system
raises certain hardware implementation difficulties so that signed arithmetic
processes are invariably performedusing 2's complement notation.
The major advantage of 2's complement over 1's complement is that 2's
complement has only one value for zero. One's complement has a "positive"
zero and a "negative" zero which is the disadvantage of 1's complement.
Also note that there is no addition of end around carry in 2’s complement
method.
Example 1.15: Compute binary arithmetic operation for 9 – 5 using 2’s
Complement.
Note: Refer table 1.4 for the equivalent values.
Here keep the binary equivalent of 9 (1001) as it is and keep the 2’s
complement equivalent of 5 (1011) and add both vales to get the result 4,
ignore carry generated MSB bit.
1001
1011
10100
Discarding the carry (i.e. 1), we get the answer 0100 which is equal to 4 in
decimal.
Excess Notation
The excess notation is a means of representing both negative and positive
numbers in a manner in which the order of the bit patterns is maintained.
The algorithm for computing the excess notation bit pattern is as follows:
1. Add the excess value 2N-1, (where N is the number of bits used to
represent the number) to the number.
2. Convert the resulting number into binary format.
The 2N–1 is often referred to as the Magic Number for computing the excess
representation of the number (except that there is no magic in it). Table 1.9
presents all the numbers that can be represented using the excess-8
notation.
Table 1.9: Numbers using the Excess-8 representation
Number Excess Number Bit Pattern
7 15 1111
6 14 1110
5 13 1101
4 12 1100
3 11 1011
2 10 1010
1 9 1001
0 8 1000
-1 7 0111
-2 6 0110
-3 5 0101
-4 4 0100
-5 3 0011
-6 2 0010
-7 1 0001
-8 0 0000
The number of bits used to represent a code in excess-8 is 4 bits. Also, the
bit patterns are in sequence (the largest number that can be represented
has the bit pattern 1111).
The result of the addition operation is the bit-pattern used for 5 in binary.
1.9 Summary
Let us recapitulate the important concepts discussed in this unit:
• In decimal number system, we have ten different digits or symbols
i.e. 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.
• The base of octal number system is 8, means the number system has
eight different digits 0, 1, 2, 3, 4, 5, 6 and 7.
• Any octal digit can be represented by a group of three binary digits (or
Bits)
• In Hexadecimal number system, we have sixteen different digits or
symbols i.e. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and A, B, C, D, E and F.
• The negative number can be represented in many ways. They are
Signed magnitude, 1’s complement and 2’s complement.
• 2’s complement is obtained by complementing the binary digits i.e. bits
and then 1 is added to it.
• The major advantage of 2's complement over 1's complement is that 2's
complement has only one value for zero.
b. 1021
3. Convert the following hexadecimal numbers to base 10:
a. 145
b. A2C1
4. Convert the following decimal numbers to base 2:
a. 122
b. 98
5. Convert the following decimal numbers to hexadecimal:
a. 1145
b. 2421
6. Perform the following binary arithmetic operations
a. 101011 + 10111
b. 1101 + 1110 + 1001
c. 11101 –10110
d. 1100.010 – 1000.111
7. Write the 8-bit signed magnitude, 2's complement and 1's
complementform of the following decimal numbers: a. + 119
b. – 77
c. – 3
8. Perform the following arithmetic operations using 2's complement
a. 9 – 8
b. 10 - 6
1.11 Answers
Self Assessment Questions
1. 10
2. 255
3. 0 to 255.
4. 11100100
5. (0101)
6. (0100)2
7. (0101)
8. 0010
9. Magic Number
10. 0012340
11. 13
Terminal Questions
1. Refer to Section 1.3 for conversion method
2. Refer to Section 1.4 forconversion method
3. Refer to Section 1.5 for conversion method
4. Refer to Section 1.7 for conversion method
5. Refer to Section 1.7 for conversion method
6. Refer to Section 1.7 for conversion method
7. Refer to Section 1.6 for method
8. Refer to Section 1.8 for 2’s complement subtraction method