3.1.3 · D5Boolean Algebra & Logic Gates
Question bank — Two's complement signed numbers
A quick recap of every symbol used below, so nothing appears unexplained:
Definition Symbols in one place
- = the number of bits (e.g. 8). The bits are , where is the rightmost (least significant) bit and is the leftmost (most significant, the MSB).
- = the bitwise NOT of : flip every
0to1and every1to0. - = the total count of bit patterns available (for 8 bits, ).
- = "the remainder after wrapping around a circle of steps" — the clock arithmetic the machine actually does.
- = XOR: outputs
1only when the two inputs differ. - = the carry into the MSB column; = the carry out of the MSB column (the carry that would fall off the top).
True or false — justify
The most-significant bit is only a plus/minus label.
False. It carries a real negative weight . In Sign-magnitude representation it is a mere label, but in two's complement
1000 0000 equals , not "minus zero-magnitude."Every -bit two's complement pattern names a distinct number.
True. There are patterns and exactly integers in , a perfect one-to-one match — unlike sign-magnitude which wastes a pattern on a second zero.
The range is symmetric about zero.
False. There is one more negative than positive because the single zero code frees one extra pattern for negatives. For 8 bits: .
Discarding the carry-out of a signed addition loses information and corrupts the answer.
False. The carry-out is worth , and , so dropping it is exactly correct for signed arithmetic. Losing it is required, not a bug.
A carry-out of 1 always means the signed answer overflowed.
False. Carry-out is the unsigned overflow signal; signed overflow is . E.g. produces a carry-out yet the signed result () is perfectly correct.
Two's complement uses a separate circuit for subtraction.
False. Subtraction is just "add the negative": . The same Full adder chain does both — that reuse is the whole point of the scheme.
The lower bits of a negative number give its magnitude.
False. For
1111 1011, the low 7 bits read as , not . To read the magnitude you must first negate (invert + add 1).Inverting all the bits of gives .
False. Inverting gives , which is . You must add 1 to reach . That "off by one" is exactly what One's complement leaves unfixed.
Adding two positive numbers can never overflow in two's complement.
False. Two positives can exceed and roll into the negative half. in 8 bits gives : overflow.
Zero has exactly one representation in two's complement.
True. Only
000...0 is zero; negating it gives . This single zero is what makes the range asymmetric.Spot the error
"To negate 0000 0101, I flip the bits to 1111 1010 and I'm done — that's ."
The +1 step is missing.
1111 1010 is actually ; adding 1 gives 1111 1011 . Flipping alone yields , not ." in 8 bits, negated, should be ."
doesn't fit in signed 8 bits (max is ). Negating
1000 0000 gives 1000 0000 again — is its own "negative," a genuine overflow with no positive twin."The number 1111 1111 is huge — it's near the top of the range."
In unsigned it's , but as signed two's complement it's (the pattern one step below
0000 0000 on the wrap-around clock). Interpretation depends entirely on whether we agreed signed or unsigned."Since here, there's definitely no overflow."
Carry-out alone can't decide signed overflow. You need . With and , XOR is — overflow, despite .
"Sign-extending 1010 from 4 to 8 bits gives 0000 1010."
Wrong padding.
1010 is ; you must copy the sign bit, giving 1111 1010, which is still . Padding with zeros would turn it into ."To multiply a two's complement number by 2, shift left — the sign is preserved automatically."
Only if no overflow occurs. Shifting
0100 0000 () left gives 1000 0000 (): the sign flipped. The shift trick is safe only within range.Why questions
Why does redefining the MSB weight as (instead of ) make one adder work for both signed and unsigned?
Because ordinary binary addition already computes results ; the wrap-around it produces is the modular reduction signed arithmetic needs, so the adder never has to know which interpretation you meant.
Why does adding 1 after inverting fix the negation?
Because (all ones), which is one short of . Adding 1 reaches , and .
Why is the carry-out safe to discard but the overflow flag is not?
The carry-out equals , so it vanishes harmlessly. Overflow means the true answer left the representable range, so the stored bits are genuinely wrong — that must be flagged.
Why does two's complement have a single zero while sign-magnitude has two?
Sign-magnitude allows both "+0" and "−0" patterns. Two's complement's wrap-around makes negating zero return the same code, collapsing them into one.
Why can two same-sign numbers overflow but two opposite-sign numbers never can?
Opposite signs move the result toward zero, staying in range. Same signs push away from zero and can cross the boundary — the only way to leave via addition.
Why is the [[Modular arithmetic|mod ]] view the "real" story rather than the negative-weight formula?
The hardware physically does clock-arithmetic mod ; the negative-weight formula is just a convenient human way to read out which residue we agreed to call negative. Both describe the same circle.
Edge cases
Negate the most negative number .
You get back (overflow). Inverting gives , and adding 1 wraps to again. It has no positive counterpart.
What is 1111...1 ( ones) as a signed value, for any ?
Always . It sits one step below
0 on the wrap-around clock, and the weights sum to .The smallest positive and its negation: negate 0000 0001.
Flip to
1111 1110, add 1 → 1111 1111 . Clean, no overflow — the symmetric pair both exist.In 1-bit two's complement, what values exist?
Only the bit itself with weight : pattern
0 is , pattern 1 is . Range is — no positives at all.Adding to the largest positive .
0111...1 + 1 = 1000...0 . The result silently overflows to the most negative number — the top edge of the range wraps to the bottom.Recall One-line self-test before you leave
Give the single sentence that explains why two's complement lets one adder subtract. Answer ::: Subtracting equals adding (which is ), and binary addition already works mod , so no dedicated subtractor is needed.
Connections
- Parent · Two's complement — the derivations these traps stress-test
- Sign-magnitude representation — source of the "MSB is just a label" trap
- One's complement — source of the "invert is enough" trap
- Overflow and carry flags — the vs carry-out confusion
- Modular arithmetic — why discarding carry is exact
- Full adder — the one circuit that does both add and subtract