Complement: a number that when added

  • Context: High School 
  • Thread starter Thread starter jackson6612
  • Start date Start date
Click For Summary
SUMMARY

The discussion focuses on the mathematical concept of "complement," specifically in the context of assembly language programming and binary arithmetic. A complement is defined as a number that, when added to another number of the same sign, yields zero after discarding the leftmost significant digit. Examples provided include base 10 complements, such as 3 and 7, and binary complements, such as 1010 and 0110. The use of complements simplifies subtraction operations in computing, making it more efficient than using separate circuits for subtraction.

PREREQUISITES
  • Understanding of basic arithmetic operations
  • Familiarity with binary number systems
  • Knowledge of assembly language programming concepts
  • Basic understanding of digital circuit design
NEXT STEPS
  • Research "Two's complement in binary" for deeper insights into binary arithmetic.
  • Explore "Assembly language subtraction techniques" to understand practical applications.
  • Learn about "Digital circuit design for arithmetic operations" to see hardware implementations.
  • Study "Mathematical properties of complements" for theoretical foundations.
USEFUL FOR

This discussion is beneficial for computer science students, software developers, and engineers interested in understanding binary arithmetic and its applications in assembly language programming and digital circuit design.

jackson6612
Messages
334
Reaction score
1
http://www.merriam-webster.com/dictionary/complement" (noun)
2 c : a number that when added to another number of the same sign yields zero if the significant digit farthest to the left is discarded —used especially in assembly language programming
[M-W's Col. Dic.]

Could you please tell me what this definition means? Please remember I'm not a math student.
 
Last edited by a moderator:
Mathematics news on Phys.org
jackson6612 said:
http://www.merriam-webster.com/dictionary/complement" (noun)
2 c : a number that when added to another number of the same sign yields zero if the significant digit farthest to the left is discarded —used especially in assembly language programming
[M-W's Col. Dic.]

Could you please tell me what this definition means? Please remember I'm not a math student.

Some examples:

In base 10, the compliment of 3 would be 7 because 3+7 = 10 and if you discard the 1, you are left with 0

Thus 4 is the compliment of 6, 8 of 2, etc.

The compliment of 55 would be 45, because 55+45=100 and removing the 1 leaves you with 0 again.

With binary, the compliment of 1 is 1 because 1+1 =10

The compliment of 1010 would be 0110 because 1010 + 0110 = 10000 in binary.

This is handy because compliments can be used for subtraction.
Say you want to subtract 3 from 7. you can do this by converting the 3 to its compliment(7) and add it to 7. This gives you 7+7=14. discard the 1 and you get 4. This is cumbersome with base ten, but works well with binary.

If you take 1010, and convert the 1s to 0s and the zeros to 1, you get 0101, if you then add 1 to this, you get 0110. This works for every binary number.

So it is very easy to convert to a binary compliment.

So for computers, it is simpler to convert to a compliment and add, rather than having a second circuit for subtraction.
 
Last edited by a moderator:

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 10 ·
Replies
10
Views
7K
  • · Replies 11 ·
Replies
11
Views
7K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 6 ·
Replies
6
Views
6K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K