There are four main subtraction expressions namely: 1. 0_{2} 0_{2} =0_{2} 2. 1_{2} 0_{2} =1_{2} 3. 1_{2} 1_{2} =0_{2} 4.
10_{2} 1_{2} =1_{2} (borrow 1 from the next most significant digit
to make 0 which becomes 10_{2}, hence 10_{2} 1_{2 }=1_{2} Here are some examples of binary subtraction.
These are computed without regard to the word
size, hence there can be no sense of "overflow" or "underflow".
Work the columns right to left subtracting in each column. If you must
subtract a one from a zero, you need to “borrow” from the left,
just as in decimal subtraction. The main purpose of using the ones complement in computers is to perform binary subtractions. For example to get the difference in 53, using the ones compliment, we proceed as follows: 1. Rewrite the problem as 5 + (3) to show that the computer performs binary subtraction by adding the binary equivalent of 5 to the ones compliment of 3. 2. Convert the absolute value of 3 into 8bit or 4bit for smaller numbers equivalent i.e. 00000011_{2}. 3. Take the ones compliment of 00000011_{2} i.e. 11111100_{2} which is the binary representation of 3_{10}. 4. Add the binary equivalent of 5 to the one’s complement of 3 i.e. 00000101 + 11111100 (1)00000001 Looking at the difference of the two binary numbers, you will observe that:
Example: Let's consider how we would solve our problem of subtracting 1_{10} from 7_{10} using 1's complement.
Step 1: Rewrite the equation thus: 11_{10} + ( 13_{10}) Step 2: Convert decimals to binary 11_{10} = 1011_{2} 13_{10} = 1101_{2} Step 3: Convert 13_{10 }= 1101_{2 }into ones compliment (13_{10}) in this case 1101_{2} is converted to 0010_{2 }this means that 0s turn to ones and ones turn to zeros Step 4: insert overflows to show sign bit i.e. positive or negative 11_{10} = (0)1011_{2} 13_{10 }= (1)0010_{2} zero (0) stands in for a positive sign bit and one (1) stand in for a negative sign bit Step 5: add (0)1011_{2 }to_{ }(1)0010_{2} (1)0010_{2}
Like in one’s compliment, the two complement of a number is obtained by negating a positive number to its negative counterpart. For example, to get the difference in 5 – 3, using the two’s complement, we proceed as follows: 1. Rewrite the problem as 5 + (3) 2. Convert the absolute value of 3 into 8bit binary equivalent i.e. 00000011 3. Take the ones complement of 00000011 i.e. 11111100 4. Add a 1 to the ones compliment i.e. 11111100 to get 11111101 5. Add the binary equivalent of 5 to the twos complement of 3 i.e.
6. Ignoring the overflow bit, the resulting number is 0000010 which is directly read as a binary equivalent of +2 Example: Now let's consider how we would solve our problem of subtracting 1_{10} from 7_{10} using 2's complement.
Algebraic Expression
1. Work out the following binary subtractions i. 11001_{2} – 1010_{2} = ii. 101_{2} – 100_{2} = iii. 11011_{2} – 111_{2} = iv. 1100_{2} – 011_{2} = v. 111011_{2} – 110_{2} = vi. 1000_{2} – 11_{2} = vii. 01101_{2} – 1011_{2} = viii. 11111111_{2} – 10101101_{2} = ix. 11101101_{2} – 100111_{2} = x. 100000_{2} – 1111_{2} = 2. Convert the decimal number 7 to 8bit binary using ones and twos complement 3. Using 8bit length, find the twos compliment of the following decimal numbers A) 31_{10} B) 28_{10} C) 5_{10} 4. Using ones and twos complement perform the following arithmetic operations a) 14_{10} – 7_{10} = b) 28_{10} – 12_{10} = c) 34_{10} 33_{10} = d) 100_{10} – 50_{10} = e) 102_{10} 64_{10} =
5. Perform the following subtractions a) 1000_{2} 10_{2} = b) 11111_{2} – 1111_{2} = c) 11011_{2} – 111_{2} = 6. Perform the following in ones complement, showing that ab is the same as a+(b) where ‘a’ is the positive number and ‘b’ is the negative number a) 1000_{2} – 10_{2} = b) 11110_{2} – 111_{2} = c) 100000_{2} – 100_{2} = 7. Repeat number 3 above using twos complement More Topical Questions Form Three Click Here

Notes and Revisions > Computernotes > ComputerForm3 > 1. DATA REPRESENTATION IN A COMPUTER > 3. Types of Data Representation >