Two's Complement
The recipe is taught as a rule about negatives: flip every bit and add one. That is true and it hides the reason. Two's complement is arithmetic modulo 256, and the consequence is that a byte is not a signed number or an unsigned number, it is eight bits that can be read either way. The adder underneath has no opinion. There is no signed mode to switch into, because the same addition is already correct for both readings.
One pattern, two numbers, and one addition that suits both
A, click any bit to flip it
B
A + B, the same addition either way
The top bit is drawn with a dashed edge because it is the only one the two readings disagree about. Every other bit is worth the same in both.
These ran in this browser when the page loaded. The last row is the one worth reading twice: the carry out of the top bit and signed overflow are different questions, and they disagree on about half of all pairs.
| claim | held | measured |
|---|---|---|
| flipping the bits and adding one is the same as subtracting from 256 | yes | all 256 values, 0 disagreements |
| one addition is correct read as unsigned and read as signed | yes | 65,536 pairs, 0 unsigned and 0 signed wrong |
| the two readings of a pattern differ by 256 exactly when the top bit is set | yes | 0 patterns disagree |
| exactly two values are their own negative, and one of them is not zero | yes | 0 and -128 |
| the carry out of the top bit is not the same thing as signed overflow | yes | 32,512 of 65,536 pairs where the two disagree |
What is real here, and what is not
What the two dates on this page are
1945 is von Neumann's First Draft of a Report on the EDVAC, cited below, which is where the arithmetic is proposed. 1949 is the year a machine built on that design was running: EDSAC executed its first program in May 1949. The pair is a proposal and a working machine, and neither end is the year anybody started calling it two's complement.
Eight bits, because a width has to be chosen
Everything here is modulo 256. The idea does not depend on 8: the same argument holds for any width, with 2 to the n in place of 256. What 8 does hide is that the choice of width is where overflow lives. A number that fits in 16 bits and not in 8 is not a different number, it is the same arithmetic against a different modulus.
The year was doubly sourced and now the day is too
Two independent sources put the First Draft in 1945 and the chronology sorts it there. This entry used to say the day could not be verified, because the museum's timeline gives only the year and the scanned report has no text layer to read — and then the next entry printed 30 June anyway, which is a page refusing something and doing it three paragraphs later. An outside audit caught it. The museum's own dated record settles the day: its entry is headed “june 30, 1945” above the words ““First Draft of Report on EDVAC” Published”. This page used to run those two together into one sentence and print the result as a quotation, which is a sentence nobody wrote. So the day is printed here on purpose now, and this entry says what it used to say rather than quietly dropping it.
This is the representation, not von Neumann's machine
The First Draft of a Report on the EDVAC, 30 June 1945, sets out the representation and the arithmetic that goes with it. It does not follow that the page models the EDVAC, which it does not: no memory, no delay lines, no instruction set. What is modelled is the property that eventually made the representation dominant, which is that it needs no separate subtractor and no signed mode.
The carry and the overflow are different questions
The page prints both because they are easy to confuse and the confusion is expensive. The carry out of the top bit says the unsigned result did not fit. Signed overflow says the signed result did not fit. On 8 bits they disagree on 32,512 of the 65,536 possible pairs, and that count is measured in this browser at load rather than quoted from anywhere.
No sound
Nothing here has a duration, so there is nothing a sound could measure.
Sources
- John von Neumann, First Draft of a Report on the EDVAC, 1945. The document itself, as a scan. It carries no text layer, so nothing here quotes it: it is cited as the source of the representation and read as an image.
- Computer History Museum timeline, 1945. Independently places the First Draft in that year. Fetched and checked: it gives the year and no month.
- Computer History Museum, This Day in History: June 30. The museum's dated entry, which is where the day comes from, and whose wording is quoted exactly above.
- Logical Art, the studio this belongs to.