Non-Positional Number System: Data Representation
Non-Positional Number System: Data Representation
In computer the data and instruction is stored in memory using binary code (or machine code)
represented by Binary digIT’s 1 and 0 called BIT’s.
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
Non-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.
Positional Number System
This type of number system are:
o Decimal number system
o Binary number system
o Octal number system
o Hexadecimal number system
The total number of digits present in any number system is called its Base or Radix.
Every number is represented by a base (or radix) x, which represents x digits.
The base is written after the number as subscript such as 512(10).It is a Decimal number as its
base is 10.
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
Decimal Number System
It is the most widely used number system.
The decimal number system consists of 10 digits from 0 to 9.
It has 10 digits and hence its base or radix is 10.
Example: 123(10), 456(10), 7890(10).
Consider a decimal number 542.76(10) which can be represented in equivalent value as:
Binary Number System
1
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:
2
Number system conversion: to convert decimal without fraction (whole number)
to any other number system we have to undergo following sequence of steps
Step1: Divide the given decimal number by the base value to which you want to
convert
Step2: Note down the quotient and reminder
Step3: repeat step 1 and 2 until quotient become zero or not possible to divide
step4: The first reminder is LSB and last reminder is the MSB. Write the answer
from MSB and LSB
3
Decimal fraction to any other type conversion: We have to undergo following
sequence of steps
Step1: Multiply the decimal fraction by the base value to which you want to
convert and note down carry and product
Step2: Repeat step1 until the fractional product become zero
Step3: The first carry will be MSB and last carry will be LSB
4
Binary to octal conversion: The binary digits are grouped into group of three bits
starting from binary point and convert each group into its equivalent octal
number. For whole numbers it may be necessary to add a zero as the MSB.
Similarly when representing fractions , it may be necessary to add a trialing zero
in the LSB to complete grouping of three bits
Octal to binary conversion: Each octal digit is represented by a three bit binary
number as in table
5
Binary to hexadecimal conversion: The binary digits are grouped into group of
four bits starting from binary point and convert each group into its equivalent
hexadecimal number. For whole numbers it may be necessary to add a zero as the
MSB. Similarly when representing fractions , it may be necessary to add a trialing
zero in the LSB to complete grouping of four bits
The following table shows hexadecimal number and its equal 4 bit binary value
Decimal Binary Hexadecimal
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F
6
Hexadecimal to binary conversion: Each digit of hexadecimal number is replaced
by a 4 bit number.
Consider a hexadecimal number CEBA(16) =1100111010111010(2)
C121100
E141110
B111011
A101010
Octal to hexadecimal conversion:
Step1: Write the binary equivalent of each octal digit
Step2: Regroup them into 4 bits from the right side
Step3: Convert each group into its equivalent hexadecimal digit
Example: Convert 274(8) to hexadecimal
274 010111100BC(16)
Hexadecimal to octal conversion:
Step1: Write the binary equivalent of each hexadecimal digit
Step2: Regroup them into 3 bits from the right side
Step3: Convert each group into its equivalent octal digit
Example: Convert FADE(16) to octal
FADE 1111101011011110175336(2)
7
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
8
Representation of signed integers: The digital computer will handle both positive
and negative integers. The sign of the number is represented by prefixing + or –
sign. This is done by adding left most bit to the number called sign bit. If the
number is positive then sign bit is 0 and the number is negative then the sign bit is
1. Hence it is also called fixed point representation. A negative signed integer can
be represented
a) sign and magnitude representation: An integer containing a sign bit followed
by magnitude bit is known as sign magnitude representation. The MSB is always
sign bit and remaining is magnitude bit
Example:
Note: If computer word size is 7 bit then 27=128 so by sign and magnitude we can
represent the number -128 to +127
b) One’s compliment form: It is the simplest form, here we can convert to one’s
complemented value of binary number by converting each zero to one and one to
zero .
Thus the one’s complemented value of 101000 is 010111
c) Two’s complement form: The two’s complemented binary number can be
obtained by adding one to the one’s complimented binary number. Consider the
binary 101000 its 2’complemented value is obtained as 1’s complemented value
of 101000+1
9
i.e. 010111+1=011000
Subtraction using 1’s complemented form: we have to undergo following steps
Step 1:convert given integer to binary
step 2: identify minuend and subtrahend
step 3: write down 1’s complement of the subtrahend.
step 4: Add 1’s complemented subtrahend with the minuend.
step 5: observe the result and do one of the following step
a) If the result of addition has a carry-over then it is dropped and an 1 is added to
LSB
b) If there is no carry over, then write 1’s complement of the result of addition
and put negative sign
Subtraction using 2’s complemented form: we have to undergo following steps
Step 1:convert given integer to binary
step 2: identify minuend and subtrahend
step 3: write down 2’s complement of the subtrahend.
step 4: Add 2’s complemented subtrahend with the minuend.
step 5: observe the result and do one of the following step
a) If the result of addition has a carry-over then it is discard he carry and the
remaining bit is the difference
b) If there is no carry over, then write 2’s complement of the result of addition
and put negative sign
Example: Subtract 15 from 23 using 1’s complemented method
10
Example: subtract 52 from 25 using 1’s complement
11
Example: Subtract 47 from 26 using 2’s complement method
Note: In the above example there is no carry so answer should represent in 2’s
complement form and put minus sign
b) Excess-3 BCD code or XS-3 code: It is a non weighted code and is obtained from
12
8421 BCD code by adding 3(0011)
13