Related Concepts: 1.01 Positional Number Systems & Base Conversions | 1.02 Base Complements & Subtraction Mechanics | 2.04 Error Control, Parity Generators & Checkers
1.03 Signed Representation, Overflow & Two’s Complement
Overview
Since physical circuits cannot store ”+” or ”-” characters, digital systems dedicate the Most Significant Bit (MSB) of a binary word to represent the sign of a number. The universally adopted system for signed integers in computers is the Signed 2’s Complement System.
1. Signed Binary Representations and Ranges
For an -bit binary word, there are three primary methods used to represent positive and negative integers:
- Sign-Magnitude Representation:
- The MSB is the sign bit (
0for positive,1for negative). The remaining bits store the absolute magnitude in true binary. - Range:
- Drawback: Dual representation of zero ( is and is ), complicating arithmetic logic.
- The MSB is the sign bit (
- Signed 1’s Complement Representation:
- Positive numbers are identical to Sign-Magnitude. Negative numbers are created by inverting all bits of their positive counterpart.
- Range:
- Drawback: Still has dual representation of zero ( and ).
- Signed 2’s Complement Representation:
- Positive numbers are written in true binary. Negative numbers are represented by taking the 2’s complement of the positive value.
- Range:
- Benefit: Unique representation of zero (). It also enables subtraction to be handled by standard addition hardware.
1.1 Differences between Signed Binary Representations
| Feature | Sign-Magnitude | Signed 1’s Complement | Signed 2’s Complement |
|---|---|---|---|
| MSB Function | 0 = Positive, 1 = Negative | 0 = Positive, 1 = Negative | 0 = Positive, 1 = Negative |
| Negative Number Formula | Keep MSB as 1, copy magnitude. | Invert all bits of positive number. | Take 2’s complement of positive number. |
| Range (for bits) | |||
| Representation of Zero | Two representations: (00...0) and (10...0). | Two representations: (00...0) and (11...1). | One unique representation: 00...0 (always positive). |
| Hardware Arithmetic Complexity | High. Requires separate addition and subtraction circuits. | Medium. Requires “End-Around Carry” addition. | Low. Single standard adder handles both addition and subtraction. |
| Mathematical Asymmetry | Symmetric range around zero. | Symmetric range around zero. | Asymmetric. Has one extra negative number (e.g. in 4-bit). |
1.2 Comparison Table ( bits)
| Decimal | Sign-Magnitude | Signed 1’s Complement | Signed 2’s Complement |
|---|---|---|---|
| (not defined) | |||
| (not defined) | (not defined) |
2. 8-Bit Signed Arithmetic Tutorial
In an 8-bit computer register, addition and subtraction are handled by standard 8-bit binary addition. Any carry beyond the 8th bit (the sign bit) is discarded.
graph TD Start["Setup Operands"] --> trueA["Write +A in 8-bit Binary"] Start --> trueB["Write +B in 8-bit Binary"] trueA --> compA["Find -A (2's Comp of +A)"] trueB --> compB["Find -B (2's Comp of +B)"] compA & compB & trueA & trueB --> Add["Perform 8-bit Addition Only"] Add --> Carry{"Carry-out from 8th bit?"} Carry -->|Yes| Disc["Discard Carry"] Carry -->|No| Check["Check MSB of Sum"] Disc --> Check Check -->|MSB = 0| Pos["Result is Positive. Convert directly to Decimal"] Check -->|MSB = 1| Neg["Result is Negative. Take 2's Comp to read magnitude"]
Worked Exam Problem (PYQ 2016, 2017, 2020, 2021, 2025 — 8 to 13 marks)
Question (2021, verbatim): and are integer variables in a computer program with and . Assuming that the computer uses 8-bit two’s complement arithmetic, show how it would compute , , and .
Variants: 2016 and 2017 used ; 2025 asked for only and (08 marks); 2020 made it roll-number dependent — , — so memorising the numbers is useless. Memorise the four-operand setup instead.
Step 0: Pre-Calculation Operand Setup
Convert the absolute magnitudes to 8-bit binary first:
Now write the four required operands: