Two's complement – You beauty
This all is suddenly less surprising for people who learned some <i>modulo arithmetics</i> in school (or university). That is, calculating with the remainders of division. For example:<p>- Calculating &quot;modulo 60&quot; means calculating time with a round clock in mind, considering only minutes and ignoring hours (and seconds).<p>- Calculating with angles (in degrees) means just calculating &quot;modulo 360&quot;.<p>- &quot;modulo 1000&quot; means calculating with the last 3 decimal digits of an integer, ignoring the front digits.<p>The fundamental result here is: No matter modulo which number you calculate: addition, negation, subtraction and multiplication work &quot;out of the box&quot;. And you&#x27;ll quickly notice that &quot;two&#x27;s complement&quot; just means calculating modulo 2^n, where n=8,16,32,64 or 128. But this all really works for any m &gt;= 2, not just m = 2^n.<p>(One drawback though: division doesn&#x27;t work here, it works only if m is prime, and even then it is slightly different from what you&#x27;d expect, although completely logical.)<p>In short, the elegance comes from modulo arithmetics. It has nothing to do with &quot;two&quot; or &quot;binary&quot;, it would e.g. work with 3-state logic machines the same way.<p><i>EDIT: To those who downvoted this: Do you care to elaborate? The author did&#x27;t mention modulo arithmetics with a single word, although it is an essential part to truly understand how and why two&#x27;s complement works.</i>