How do you use "Complement Addition" to subtract binary, hexadecimal, and decimal numbers?

Printable View

- February 5th 2008, 03:30 PMSMAlvarezComplement Addition
How do you use "Complement Addition" to subtract binary, hexadecimal, and decimal numbers?

- February 5th 2008, 11:14 PMearboth
1. You can use this method only if you have a limited number of digits to write a number.

2. You have to use a carry bit for these operations.

3. You have to calculate the compliment of a number first.

Examples:

a) decimal numbers with 4 digits. The first digit is reserved for the sign of the number: 0 = + and and the highest possible digit (here: ) 9 = -

If you want to calculate 0273 - 0086 you first calculate the compliment of 0086 by determining the difference of each digit to highest possible digit (=9). You'll get 9913. Set the carry bit to 1 (indicating that you want to subtract):Code:`number: 0273`

compl.: 9913

carry: 1

------------------

(9)0187

b) binary numbers with 8 digits. Use exactly the same method but note that now the highest possible digit is 1.

If you want to calculate that means 00001101 - 00000111 you first calculate the compliment of 00000111 by determining the difference of each digit to highest possible digit (=1). You'll get 11111000. Set the carry bit to 1 (indicating that you want to subtract):Code:`number: 00001101`

compl.: 11111000

carry: 1

--------------------

(1)00000110

c) With hexadcimal numbers you only have to consider that you have 16 different digits and that highest possible digit is F. Use exactly the same method as demonstrated above.