This document discusses different methods for representing negative numbers:
Unsigned representation uses only positive numbers from 0 to 2n-1. Signed representation uses the most significant bit to indicate sign, allowing numbers from -2n-1 to 2n-1-1. 1's complement has drawbacks of two representations of zero and requires adding the carry when adding. 2's complement overcomes these by using the complement of the bit pattern to represent negative numbers, allowing an increased range from -2n-1 to 2n-1-1 without issues of multiple zero representations or carry additions.
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Data representation
1. DATA REPRESENTATION:
In data representation, we will look for how negative numbers can be
represented.
UNSIGNED REPRESENTATION:
Only positive number will be represented, if it’s of 3 bit the range of number of
unsigned magnitude is (0 to 7).
For n bit, the range of a number can be represented in unsigned magnitude is
(0 to 2n
-1).
SIGNED REPRESNTATION:
Both of positive and negative number will be represented.
For positive number the magnitude is of same magnitude and MSB bit is of 0.
For negative number the magnitude is of same magnitude and MSB bit is of 1.
For 4 bit , the range of number can be represented as :
2. MSB MSB
0 000 0 1 000 -0
0 001 1 001
0 010 1 010
0 011 1 011
0 100 1 100
0 101 1 101
0 110 1 110
0 111 7 1 111 -7
For n bits range of a number can be represented in signed magnitude
representation as (-2n-1
-1 to 2n-1
-1).
Drawbacks:
Two types of “0” representation are there in this format.
1’s COMPLEMENTREPRESENTATION:
Both positive and negative number will be represented.
For positive number, the magnitude is of the same magnitude and MSB bit is of
0.
For negative number, the magnitude should be 1’s complemented and MSB bit
is of 1.
For 4 bit , the range of number can be represented as :
3. MSB MSB
0 000 0 1 111 -7
0 001 1 110
0 010 1 101
0 011 1 100
0 100 1 011
0 101 1 010
0 110 1 001
0 111 7 1 000 -0
For n bits range of a number can be represented in 1’s Complement
representation is (-2n-1
-1 to 2n-1
-1).
Drawbacks:
Two types of “0” representation also in this format.
When performing addition operation if we got final carry in order to get the
final carry is also added to the result.
There is no range extension.
In order to overcome all the drawbacks, we go for 2’s complement.
2’S COMPLEMENT:
Both positive and negative number will be represented.
For positive number magnitude is of same magnitude and MSB is 0.
4. For negative number magnitude will be represented in 2’s Complement and
MSB bit is of 1.
Shortcuts:
Eg: 1 0110
MSB
Method 1 : 1 0110
1001
1
1 1010 ( -10)
Method 2: 1 0110
N=22 (decimal value)
n=5 ( no. of digit )
= N-2n
=22-25
= -10
Method 3: 1 0110
-16 8421
= -16+8+4+2+1= -10
For 4 bit , the range of number can be represented as :
5. MSB MSB
0 000 0 1 000 -8
0 001 1 111
0 010 1 110
0 011 1 101
0 100 1 100
0 101 1 011
0 110 1 010
0 111 7 1 001 -7
For n bit the range of numbers we can represent as (-2n-1
) to (2n-1
– 1).
Advantage:
a) Only one representation for ‘0’.
b) Range is increased.
c) Final carry will be discarded in 2’s Complement.
d) 2’s Complement have a 8 4 2 1 extension.
e) 2’s Complement has a extension bit.
Eg: 1101 which gives -3.
( -8+4+1) = -3
It can be extended to 8 bit.
i.e. 1111 1101
Extension bit which leads to same value i.e. (-128+64+32+16+8+4+1) = -3