This preview shows page 1. Sign up to view the full content.
Representation of negative numbers
SignedMagnitude representation:
•
This is the simplest method.
•
Write the magnitude of the number in binary.
Then add a 1 to the front of it if the
number is negative and a 0 if it is positive.
•
Examples:
+7 would be 111 and then a 0 in front so 00000111 for an 8bit
representation.
9 would be 1001 (+9) and then a 1 so 10001001 for an 8bit representation.
•
It is not the best method or representation because it makes computation
awkward.
2’s complement representation:
•
Most widely used method of representation.
•
Positive numbers are represented as they are (simple binary).
•
To get a negative number, write the positive number in binary, then change all 0’s
to 1’s and 1’s to 0’s.
Then add 1 to the number.
•
Example :
+7 would be 0111 in 4bit 2’s complement.
To represent –5 we take +5 (0101) and then invert the digits (1010) and add 1
(1011).
–5 is thus 1011.
•
Suppose you already have a number that is in two’s complement representation
This is the end of the preview. Sign up
to
access the rest of the document.
 Spring '08
 LAM

Click to edit the document details