New Document
 Electronics Electronics Catlog DIC Catlog

 Number System Conversions Between Number System Arithematic Operations 1's & 2's Complement Gray Codes Arithmetic Circuits Logical Gates and Truth Table Funtions Boolean Expressions Boolean Algebra Karnaugh Map Multiplexer DeMultiplexer Encoder & Decoder TTL Circuits Multivibrators 555 Timer Flip Flops RS Flip - Flop JK Flip - Flop D Flip - Flop Shift Register Schmitt Trigger Asynchronous Counters Synchronous Counters Digital - Analog Conversion Data Flow ROM Memory Drives Electronics Equation Resistor Color Codes

## 1s and 2s Complement

To perform a binary subtraction you first have to represent the number to be subtracted in its negative form. This is known as its two's complement.

The two's complement of a binary number is obtained by:

1. Replacing all the 1s with 0s and the 0s with 1s. This is known as its one's complement.

2. Adding 1 to this number by the rules of binary addition.

Now you have the two's complement.

Example:

The decimal subtraction 29 - 7 = 22 is the same as adding (29) + (-7) = 22

1. Convert the number to be subtracted to its two's complement:

 00000111 (decimal 7) 11111000 (one's complement) + 00000001 (add 1) 11111001 (two's complement)

2. 11111001 now represents -7.

 29 00011101 +-7 11111001 22 (1)00010110

4. Note that the final carry 1 is ignored.

### Subtracting using 1s complement

For subtracting a smaller number from a larger number, the 1s complement method is as follows:

1. Determine the 1s complement of the smaller number.

2. Add the 1s complement to the larger number.

3. Remove the final carry and add it to the result. This is called the end-around carry.

Example:

11001-10011

Result from Step1: 01100

Result from Step2: 100101

Result from Step3: 00110

To verify, note that 25 - 19 = 6

For subtracting a larger number from a smaller number, the 1s complement method is as follows:

1. Determine the 1s complement of the larger number.

2. Add the 1s complement to the smaller number.

3. There is no carry. The result has the opposite sign from the answer and is the 1s complement of the answer.

4. Change the sign and take the 1s complement of the result to get the final answer.

Example:

1001 - 1101

Result from Step1: 0010

Result from Step2: 1011

Result from Step3: - 0100

To verify, note that 9 - 13 = - 4

### Subtracting using 2s complement

For subtracting a smaller number from a larger number, the 2s complement method is as follows:

1. Determine the 2s complement of the smaller number.

2. Add the 2s complement to the larger number.

3. Discard the final carry (there is always one in this case)

Example:

11001 - 10011

Result from Step1: 01101

Result from Step2: 100110

Result from Step3: 00110

Again, to verify, note that 25 - 19 = 6

For subtracting a larger number from a smaller number, the 2s complement method is as follows:

1. Determine the 2s complement of the larger number.

2. Add the 2s complement to the smaller number.

3. There is no carry from the left-most column. The result is in 2s complement form and is negative.

4. Change the sign and take the 2s complement of the result to get the final answer.

Example:

1001 - 1101

Result from Step1: 0011

Result from Step2: 1100

Result from Step3: -0100

Again to verify, note that 9 - 13 = - 4