Demo 1.3: Arithmetic Without a Minus Sign

The previous two demonstrations were about writing quantities down. This one is about doing something with them, and it runs into a problem almost immediately.
A circuit has two voltages. It has no third symbol to spend on a minus sign, no separate place to record that a value is negative, and no way to mark a number as special. Whatever “negative” is going to mean, it has to be built out of the same bits that are already carrying the number, and it has to be built in a way that a row of identical gates can process with no information about what the bits mean.
That constraint is tighter than it looks, and it is why the answer to this problem is not the one most students guess first.
Carry, and then a harder problem
Section titled “Carry, and then a harder problem”Binary addition itself is not difficult. Work from the right, add what is in each column, write down what fits and carry what does not. There are four cases and three of them are straightforward: 0 + 0 is 0, 0 + 1 is 1, 1 + 0 is 1. The fourth is 1 + 1, which is 2, and 2 will not fit in one bit. In binary it is 10, so you write 0 and carry 1.
Everything awkward about adders comes from that one line, and the first tab is there so that you can watch a carry appear and travel along a row of columns.
The harder problem starts on the second tab. Spending the top bit on a sign is the idea everyone has, it is easy to read, and it fails for most additions. Seeing how it fails is what makes the answer on the third tab make sense rather than look arbitrary.
How to use it
Section titled “How to use it”Adding bits starts at one bit wide and goes up to four, with the answer allowed a fifth bit when it needs one. Set the two numbers with the bit toggles or use the presets, then press Do it column by column and step through the sum one column at a time. The rule in use lights up in the panel underneath as you go. Start at one bit and press 1 + 1, because the main difficulty of the subject is visible there.
A bit for the sign takes the obvious approach to negative numbers and tests it on every pair. Choose two values, watch them added as ordinary binary, and read the verdict. There is a table of all sixteen patterns showing the two different zeros, and a panel that has tried every pair in range and counted how many come out right.
Two’s complement keeps the sign bit and gives it a negative weight. The weight strip at the top can be clicked, and every pattern of bits is a legal number. There is a stepper that shows the invert-and-add-one procedure a line at a time, the full sixteen-pattern table again, and an addition panel whose operands are limited so that nothing here overflows.
Subtraction is addition does a − b by negating b and adding. Step through it to see the negation happen before the sum. There are presets at four and six bits, including both of the worked examples from the reading.
Binary Arithmetic and Negative Numbers
Adding with carries, two attempts at writing a negative number, and why no computer has a subtractor.
Walkthrough
Section titled “Walkthrough”Step 1: Start with the smallest possible adder
Section titled “Step 1: Start with the smallest possible adder”Open Adding bits, set the width to 1 bit and press 1 + 1.
One bit plus one bit gives an answer that does not fit in one bit. That is the problem in its smallest form, and it is present at every width: it is why an adder has two outputs rather than one, and why the demonstration on adders later has a Sum pin and a Carry pin instead of just an answer.
Now go to 4 bits and press The largest it goes. Fifteen plus fifteen is thirty, which needs five bits, and the panel says so. The extra bit is an ordinary carry, arriving in a column that a four-bit field does not have.
Step 2: Watch a carry travel
Section titled “Step 2: Watch a carry travel”Still at four bits, press No carries, which is 5 + 10, then press Do it column by column and step through it.
Every column is independent. Each one has both its bits from the start and none of them depends on a carry from its neighbour.
Now press Ripple all the way, which is 7 + 1, and step through that. Read the commentary as each column completes: the rightmost produces a carry, which the next column needs before its result is known, which produces another carry, and so on all the way to the left.
On paper this costs you nothing but patience. In a circuit it costs time, and the demonstration on adders is largely about how much. Notice it here, while the arithmetic is simple enough that the delay is the only thing to look at.
Step 3: Try the obvious way to write a negative number
Section titled “Step 3: Try the obvious way to write a negative number”Open A bit for the sign. The scheme is what it sounds like: the top bit says which way, the other three say how much, so 0101 is +5 and 1101 is −5.
Press 5 + -5, which should give zero.
It gives +2. Look at the columns and you can see why, and the reason matters, because the adder has done nothing wrong. It added the sign column in the same way as every other column, carried into it and out of it as usual, and produced a correct four-bit sum. The bits were fine. The meaning attached to the top bit is not part of the arithmetic, so the adder could not act on it.
Now press 2 + 3 and watch it work. This case works for a specific reason: both numbers are positive, so both sign bits are 0, nothing is carried into the sign column, and the magnitudes add.
Step 4: Read the two panels underneath
Section titled “Step 4: Read the two panels underneath”The table of all sixteen patterns has 0000 and 1000 highlighted, and they are +0 and −0. There is no such number as negative zero, so one of the sixteen patterns has been wasted. The waste is the smaller problem. The larger one is that a circuit that tests whether two values are equal now has to treat these two patterns as equal despite their differing in a bit, so even a test for zero stops being a matter of looking at the bits.
Then read the counting panel, which gives the overall result. Every pair whose answer is representable was tried, and 58 out of 169 come out right. That might sound usable until you look at what the 58 are:
- 36 have both numbers non-negative, so the sign bit is never used
- 14 add zero to something, so nothing is being added
- 8 work by coincidence, and every one of them involves −4
The coincidences show how the scheme fails. A magnitude of 4 is exactly half of 8, so adding it pushes a carry out of the three-bit magnitude field and into the sign column, where it flips the sign to the value that was wanted. No part of the circuit handled the sign: a carry escaped from one field into another and happened to land correctly.
So the scheme works when you are not using the feature it exists to provide, when you are adding nothing, or by accident.
Step 5: Change one weight
Section titled “Step 5: Change one weight”Open Two’s complement and look at the strip at the top.
The columns are worth −8, 4, 2 and 1. That is the only change. Every other column is what it was in the first demonstration of the module, and a number is still the sum of the weights standing under its 1s. The top bit is now an ordinary column with a negative weight, and because it is an ordinary column, ordinary addition works on it.
Click the bits and watch the value. Then check the pattern table: sixteen patterns, sixteen different numbers, one zero. Read the right-hand column upwards from 1111 and it counts −1, −2, −3. The negative numbers are not stored backwards or in any special order: they carry on counting down past zero and wrap round to the top of the field.
Now use the addition panel. Try a few pairs, including ones with a negative in them, and note that the verdict is always correct. Nothing on this tab treats the sign specially. The columns were added from the right, carries went where carries go, and the answer came out right.
That is the case for two’s complement, and it is a claim about hardware rather than about notation: the four-bit adder built out of gates later in this module adds signed numbers correctly without a single gate being added to it, because there is nothing to add.
Step 6: Find the number with no opposite
Section titled “Step 6: Find the number with no opposite”Still on the same tab, set the negation stepper to 5 and press Step through it. Invert every bit to get 1010, add one to get 1011, and that is −5.
Now set it to −8.
Inverting and adding one gives −8 back again. The procedure is correct here: +8 needs one more bit than a four-bit field has, so there is no pattern for it. There are sixteen patterns, one of them is zero, and the remaining fifteen cannot be split evenly between positives and negatives. The odd one out is the most negative value, which is why the range runs from −8 to +7 rather than symmetrically.
Taking the absolute value of the most negative integer is a well-known source of bugs in real software, and it cannot be fixed within the same width, because the positive result has no pattern.
Step 7: Subtract without a subtractor
Section titled “Step 7: Subtract without a subtractor”Open Subtraction is addition and press 7 − 5, then Step through it.
Watch the three stages. Five is 0101, inverting gives 1010, adding one gives 1011, which is −5. Then add 0111 and 1011 in the ordinary way and the answer bits read 0010, which is +2.
A carry came out of the top column and was discarded, and that can look wrong the first time, but it is correct. A field of n bits counts in a circle of 2ⁿ values, adding walks you round that circle, and the carry out is the moment you pass the starting point. It records that a lap was completed and nothing else.
Notice too that the carry is not an error signal. Press 2 − 6, which gives −4 correctly and produces no carry out at all. Whether a carry appears depends on which two numbers you picked, not on whether the answer is right.
Then switch to six bits and press −25 + 18, which is the larger example from the reading. It gives 111001, which is −7.
The point of all this is a saving in hardware rather than in effort. An adder that can also subtract needs one inverter per bit and one spare input: feed a control line into every inverter and into the carry in at the bottom of the chain, and with it at 0 you get A + B, while with it at 1 every bit of B is inverted and a 1 arrives at the bottom, which is inverting and adding one. One wire turns an adder into a subtractor. That saving comes from a change of notation alone, and it is why two’s complement is the representation used for signed integers in practice.
Check your understanding
Section titled “Check your understanding”Why does a one-bit adder need two output bits?
Under sign and magnitude, adding +5 and −5 as ordinary binary gives 0010, which reads as +2. What has gone wrong?
Match each idea to what it does
A four-bit two's complement subtraction produces a carry out of the top column, which is discarded. What does that carry tell you?
Why can −8 not be negated in a four-bit two's complement field?
Wrap-up
Section titled “Wrap-up”Five things to carry forward.
- Binary addition is one rule. A column totals 0, 1, 2 or 3; write its bottom bit and carry its top bit. Everything else is bookkeeping.
- Two bits will not add into one bit, so an adder always produces one more bit than it consumes. This is true at one bit wide and at sixty-four.
- A sign bit that is only a label breaks arithmetic. It fails on 111 of 169 pairs, and most of the successes are cases where it was not being used.
- A sign bit with a negative weight fixes it, and costs nothing in hardware. The same row of adder cells works on signed and unsigned numbers without modification, because there is nothing to modify.
- Subtraction is addition. Negate the second operand and add, which needs one inverter per bit and one control wire, and no subtractor anywhere.
Everything here has been kept carefully inside the range. The operands on the last two tabs are limited, and that limit keeps a real problem out of view: a fixed-width field holds only so many values, and asking it for one it does not have produces a wrong answer, with no warning from the hardware.
That is overflow, and it needs its own demonstration. It comes next, along with the vocabulary for how big these fields are in the first place: the bit, the nibble, the byte and the word.
© 2026 Derek Molloy, Dublin City University. All rights reserved.