Unformatted text preview: nting sign. 0 is for
+ sign and 1 is for and ‐ sign.
• Ex, (5)10 = (101)2
• (+ 5)10 = (0101)2 and (‐ 5)10 = (1101)2
• (1101)2 could be misinterpreted as (13)10
• We must first decide how many bits are going to be
needed to represent the largest numbers we'll be
dealing with, and then be sure not to exceed that bit
field length in our arithmetic operations.
• Using 2’s complement A‐B becomes, A + (‐B). Two’s complement
• Add a MSB digit for sign representation.
• Invert all the bits of a number, changing all 1's to 0's
and vice versa.
• Then add 1. The result is 2’s complement of the
number.
• Ex, (5)10 = (101)2 = (0101)2
• Inverting, 0010 + 1 = 0011 – 2’s complement of (5)10
• 2’s complement of (‐5)10 = (1011)2 Steps for Binary Subtraction
The following gives the steps for finding the result of x – y, using
binary arithmetic, where x > y and x,y are decimal numbers.
1. Convert the first no x to binary.
2. Add one MSB as a sign bit. Count the total number of bits.
3. Convert the second no y to binary.
4. Add zeros to the left of its bits such that the number of bits is the same as in step 2.
5. Find the 2’s complement of the second no, y, as below.
• Invert the bits and add 1
6. Perform binary addition from results of step 1 and 5. Discard extrabits. 7. The result of step 6 is the answer. Convert this to decimal for a ch...
View
Full
Document
This note was uploaded on 05/05/2013 for the course ELEC 1111 taught by Professor Jayashriravishankar during the One '11 term at University of New South Wales.
 One '11
 JayashriRavishankar

Click to edit the document details