Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Subtraction
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==In computing== The [[method of complements]] is a technique used to subtract one number from another using only the addition of positive numbers. This method was commonly used in [[mechanical calculator]]s, and is still used in modern [[computers]]. {| class="wikitable floatright" ! Binary<br>digit ! Ones' <br>complement |-align="center" | 0 | 1 |-align="center" | 1 | 0 |} To subtract a binary number ''y'' (the subtrahend) from another number ''x'' (the minuend), the ones' complement of ''y'' is added to ''x'' and one is added to the sum. The leading digit "1" of the result is then discarded. The method of complements is especially useful in binary (radix 2) since the ones' complement is very easily obtained by inverting each bit (changing "0" to "1" and vice versa). And adding 1 to get the two's complement can be done by simulating a carry into the least significant bit. For example: 01100100 (x, equals decimal 100) - 00010110 (y, equals decimal 22) becomes the sum: 01100100 (x) + 11101001 (ones' complement of y) + 1 (to get the two's complement) ββββββββββ 101001110 Dropping the initial "1" gives the answer: 01001110 (equals decimal 78)
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Subtraction
(section)
Add topic