Number System
Number System
Number System
NUMBER SYSTEM
Introduction
In Digital Computer, data and instructions are stored in computer memory using binary code (or
machine code) represented by Binary digits’s 1 and 0 called BIT’s.
The data may contain digits, alphabets or special character, which are converted to bits,
understandable by the computer.
The number system uses well defined symbols called digits.
Number systems are basically classified into two types. They are:
o Non-positional number system
o Positional number system
In olden days people use of this type of number system for simple calculations like additions and
subtractions.
The non-positional number system consists of different symbols that are used to represent
numbers.
Roman number system is an example of the non-positional number system i.e. I=1, V=5, X=10,
L=50.
This number system cannot be used effectively to perform arithmetic operations.
1|Page
UNIT 3
To determine the quantity that the number represents, the number is multiplied by an integer power
of x depending on the position it is located and then finds the sum of the weighted digits.
Example: Consider a decimal number 512.45(10) which can be represented in equivalent value as:
5x102 + 1x101 + 2x100 + 4x10-1 + 5x10-2
Digital computer represents all kinds of data and information in the binary system.
Binary number system consists of two digits 0 (low voltage) and 1 (high voltage).
Its base or radix is 2.
Each digit or bit in binary number system can be 0 or 1.
The positional values are expressed in power of 2.
Example: 1011(2), 111(2), 100001(2)
Consider a binary number 11011.10(2) which can be represented in equivalent value as:
1x24 + 1x23 + 0x22 + 1x21 + 1x20 + 0x2-1 + 0x2-2
Weights 24 23 22 21 20 2-1 2-2
Digits 1 1 0 1 1 1 0
Values 16 8 4 2 1 0.5 0.25
2|Page
UNIT 3
3|Page
UNIT 3
Step 3: Repeat the Step 1 and Step 2 until the decimal number cannot be divided further.
Step 4: The first carry will be the MSB and the last carry is the LSB. The equivalent binary
4|Page
UNIT 3
Note: If the number is less than 8 the octal number is same as decimal number.
5|Page
UNIT 3
0.3125 x 8 = 2.5000 2
0.5000 x 8 = 4.0000 4
7|Page
UNIT 3
8|Page
UNIT 3
Therefore, 3F72(16)= 16242(10)
Example 2: To convert the hexadecimal number 5AF.D(16) to decimal number.
OR
Weights 162 161 160 16-1
Digits 5 A F D
Values 256 16 1 0.0625
Begin at the rightmost 3 bits. If we are not able to form a group of three, insert 0s to the left
Write the octal equivalent of each group. Repeat the steps until all groups have been converted.
1 2 7
Therefore, 1010111(2) = 127 (8)
0 6 7
Therefore, 0.110111 (2) = 0.67 (8)
9|Page
UNIT 3
1 5 5 6
Therefore, 1101.10111(2) = 15.56 (8)
Note: To make group of 3 bits, for whole numbers, it may be necessary to add a 0’s to the left of MSB
and when representing fractions, it may be necessary to add a 0’s to right of LSB.
Step 2: Convert each digit to 3-bit binary number. (Each octal digit is represented by a three-
Octal digit 0 1 2 3 4 5 6 7
Binary Equivalent 000 001 010 011 100 101 110 111
10 | P a g e
UNIT 3
Conversion from Binary to Hexadecimal
Begin at the rightmost 4 bits. If we are not able to form a group of four, insert 0s to the left
Write the hexadecimal equivalent of each group. Repeat the steps until all groups have been
converted.
0 D 7
Therefore, 0.110111 (2) = 0.D7 (16)
11 | P a g e
UNIT 3
2 010
7 111
4 100
Therefore, 274 (8) = 010 111 100 (2)
Group the bits into group of 4 bits as 0 1011 1100
0 1011 1100
0 B C
Therefore, 274 (8) = BC (8)
1 7 5 3 3 6
Hence , FADE(16)=175336(8)
12 | P a g e
UNIT 3
Binary Arithmetic
It involves addition, subtraction, multiplication and division operations.
Binary arithmetic is much simpler to learn because system deals with only two digit 0’s and 1’s.
When binary arithmetic operations are performed on binary numbers, the results are also 0’s and
1’s.
Binary Addition
The addition of two binary numbers is performed in same manner as the addition of decimal
number.
The basic rules of binary addition are:
13 | P a g e
UNIT 3
a) 4 and 3 b) 9 and 5
4 101 9 1001
+3 + 011 +5 + 101
7 111 14 1110
75 = 1001011
18 = 10010
Carry 1
Append 1 1001011
Append 2 10010
Sum 1011101
Binary Subtraction
14 | P a g e
UNIT 3
When we subtract 1 from 0, it is necessary to borrow 1 from the next left column i.e. from the next
higher order position.
Example 1: Subtract the following number
a) 10 from 14 b) 9 from 29 c) 3 from 5
Exercise:
1) Subtract 01110 from 10101
2) Subtract 25 from 35
15 | P a g e
UNIT 3
The 2’s complement of a binary number is obtained by taking 1’s complement of the number and
adding 1 to the Least Significant Bit (LSB) position.
The general procedure to find 2’s complement is given by:
2’s Complement = 1’s Complement + 1
16 | P a g e
UNIT 3
Note:
Negation: It is the operation of converting a positive number to its negative equivalent or a negative
number to its positive equivalent. Negation is performed by performing 2’s complement system.
Example 1: Consider the number +12. Its binary representation is 01100(2). Find the 2’s
complement of +12.
Clearly, this is a negative number since the sign bit is 1. Actually, 10100 represent -12(10)
which is the negative equivalent of the number 12(10)
Example 2: Consider the number -12. Its binary representation is 10100(2). Find the 2’s
complement of -12.
Clearly, this is a positive number since the sign bit is 0. Actually, 01100 represent 12 (10) which
is the negative equivalent of the number -12(10)
Computer Codes
Computer code helps us to represent characters in a coded form in the memory of the computer.
These codes represent specific formats which are used to record data.
Some of the commonly used computer codes are:
o Binary Coded Decimal (BCD)
o Extended Binary Coded Decimal Interchange Code (EBCDIC)
o American Standard Code for Information Interchange (ASCII)
o Excess-3 Code.
17 | P a g e
UNIT 3
BCD code (or Weighted BCD Code or 8421 Code)
In 4-bit BCD only 24=16 configurations are possible which is insufficient to represent the various
characters.
Hence 6-bit BCD code was developed by adding two zone positions with which it is possible to
represent 26=64 characters.
The Excess-3 BCD code is a non-weighted code used to express decimal number.
The name Excess-3 code derived from the fact that each binary code is the corresponding BCD
code plus 0011(2)(i.e. Decimal 3).
This code is used in some old computers.
The following table gives the Excess-3 code equivalent of decimal (0-9).
18 | P a g e
UNIT 3
1 0001 11 0100
2 0010 11 0101
3 0011 11 0110
4 0100 11 0111
5 0101 11 1000
6 0110 11 1001
7 0111 11 1010
8 1000 11 1011
9 1001 11 1100
EBCDIC
ASCII
19 | P a g e
UNIT 3
20 | P a g e