Table of Contents
- Overview
- 1. Number Systems & Radix Complements
- 1.1 Positional Number Systems
- [[Number Systems and Complements#12-radix-r-and-diminished-radix-r-1-complements|1.2 Radix () and Diminished Radix () Complements]]
- 2. Signed Binary Representations
- 3. Comparison & Range Matrix
- 4. 2’s Complement Arithmetic, Sign Extension & Overflow
- 4.1 Sign Extension Rule
- 4.2 Addition and Subtraction
- [[Number Systems and Complements#4.3 Overflow Detection ()|4.3 Overflow Detection ()]]
- 5. IEEE 754 Floating-Point Standard
- 6. GATE PYQ-Style Solved Questions
At the lowest abstraction level, computer hardware consists of electronic circuits operating on binary digits (bits). To perform mathematical computations, digital systems must encode both non-negative integers and negative quantities, as well as real numbers with fractional components.
In this note, we develop a deep conceptual foundation for positional number systems, radix complements, 1’s and 2’s complement representations, signed arithmetic, hardware overflow detection, and the IEEE 754 floating-point standard.
1. Number Systems & Radix Complements
1.1 Positional Number Systems
In a positional number system of base (or radix) , a number represents the magnitude: Common bases used in computer computer design are Binary (), Octal (), Decimal (), and Hexadecimal ().
1.2 Radix () and Diminished Radix () Complements
Complements simplify subtraction by converting subtractive logic into additive logic. For an -digit integer in base :
-
Diminished Radix Complement ( Complement):
- For Binary (): 1’s Complement . In binary, subtracting a digit from () is equivalent to a bitwise NOT operation.
-
Radix Complement ( Complement):
- For Binary (): 2’s Complement .
2. Signed Binary Representations
To represent negative numbers in binary using bits, the Most Significant Bit (MSB) is reserved as the Sign Bit (, ).
2.1 Signed Magnitude Representation
In -bit Sign-Magnitude:
- MSB (): Represents sign ( for , for ).
- Remaining bits: Represent absolute magnitude.
Drawbacks:
- Dual Zero Representation: and . This wastes a bit pattern and requires double testing for zero in ALU logic.
- Complex Subtraction Hardware: Adding and requires separate magnitude comparators and subtractor hardware.
2.2 1’s Complement Representation & Its Limitations
In -bit 1’s complement, a negative number is formed by bitwise inverting all bits of .
The Dual Zero Problem
Like Sign-Magnitude, 1’s complement suffers from two representations of zero:
End-Around Carry Requirement
When adding two 1’s complement numbers, if an output carry is generated from the MSB, it must be added back into the Least Significant Bit (LSB) (called end-around carry). This introduces an extra clock cycle/delay in arithmetic circuits.
2.3 2’s Complement Representation (Deep Intuition)
The 2’s complement representation is the universal standard in all modern processors (x86, ARM, RISC-V).
How to Calculate 2’s Complement
To find in 2’s complement:
- Invert all bits of ().
- Add to the LSB.
TIP
Shortcut for GATE: Scan the binary number from right to left (LSB to MSB). Keep all bits unchanged up to and including the first
1. Invert every bit after that first1!
- Example for in 4 bits: .
- Scanning from right:
0(keep),1(first 1, keep),1(invert to 0),0(invert to 1) .
The Modular Clock Wheel Intuition (Modulo )
Why does 2’s complement work so perfectly without needing separate subtractor circuits?
Think of an -bit register as a modular clock wheel with positions (ranging from to ).

Student Image Note: Place an image named
twos-complement-wheel.pngin theimgs/directory. Search description: “4 bit 2s complement number wheel diagram showing signed values from +7 down to -8 and binary patterns 0000 to 1111 arranged in a circle”.
In a 4-bit register ( states):
- If you start at () and move counter-clockwise by 1 step, you land on ().
- In signed arithmetic, moving 1 step backward from should equal .
- Therefore, naturally represents !
- Moving counter-clockwise by 2 steps lands on .
- Moving counter-clockwise by 6 steps lands on .
Because arithmetic wraps around modulo : Adding the 2’s complement of () is mathematically identical to subtracting ! The ALU can use a standard adder circuit for both addition and subtraction without needing a subtractor!
Key Advantages of 2’s Complement:
- Single Unique Zero:
- .
- .
- Zero has only one representation (), eliminating ambiguity!
- Extra Negative Value:
- Because is eliminated, the bit pattern becomes available to represent an extra negative number: .
- No End-Around Carry: Any carry out from the MSB during addition is simply ignored!
3. Comparison & Range Matrix
For an -bit register, the range of representable numbers across formats is:
| Representation | Negative Range | Positive Range | Total Distinct Values | Representation of Zero |
|---|---|---|---|---|
| Unsigned | N/A | Single () | ||
| Sign-Magnitude | Dual ( and ) | |||
| 1’s Complement | Dual ( and ) | |||
| 2’s Complement | Single () |
Summary Range Table for Common Bit Widths:
| Bit Width () | Sign-Magnitude & 1’s Complement Range | 2’s Complement Range |
|---|---|---|
| 4 bits | ||
| 8 bits | ||
| 16 bits | ||
| 32 bits | [] | [] |
4. 2’s Complement Arithmetic, Sign Extension & Overflow
4.1 Sign Extension Rule
To convert an -bit signed 2’s complement number into an -bit number () without changing its value:
- Rule: Replicate the MSB (sign bit) of the -bit number into all extended bit positions on the left.
Examples:
- Extend (4-bit) to 8-bit:
- MSB is
0Extend0s .
- MSB is
- Extend (4-bit) to 8-bit:
- MSB is
1Extend1s .
- MSB is
4.2 Addition and Subtraction
To subtract :
- Compute the 2’s complement of .
- Perform binary addition .
- Ignore any final carry out of the MSB.
4.3 Overflow Detection ()
An overflow occurs when the result of an arithmetic operation exceeds the representable range of the -bit signed container.
WARNING
Overflow can only occur when:
- Adding two positive numbers yields a negative result ().
- Adding two negative numbers yields a positive result (). Adding a positive and negative number can NEVER produce an overflow!
Hardware Overflow Condition
Let be the carry going into the MSB position, and be the carry coming out of the MSB position. Overflow flag is given by:
- If (Result is incorrect).
- If (Result is correct).
5. IEEE 754 Floating-Point Standard
Real numbers with fractional parts are represented using the IEEE 754 Floating-Point Standard.
5.1 Format Breakdown (Single & Double Precision)
| Parameter | Single Precision (32-bit) | Double Precision (64-bit) |
|---|---|---|
| Sign Bit () | 1 bit (Bit 31) | 1 bit (Bit 63) |
| Exponent Bits () | 8 bits (Bits 30–23) | 11 bits (Bits 62–52) |
| Mantissa/Fraction () | 23 bits (Bits 22–0) | 52 bits (Bits 51–0) |
| Exponent Bias () | 127 () | 1023 () |
| Bias Formula |
5.2 Normalized Numbers & Hidden Bit
For a normalized number, the exponent field is neither all 0s nor all 1s ().
- Hidden 1 Rule: In binary scientific notation, every non-zero normalized number starts with a leading
1.before the binary point (e.g., ). Since this1.is always present, IEEE 754 omits it from storage to save 1 bit of precision! - The 23 mantissa bits store only the fractional part after the radix point.
Example Conversion: Convert to Single-Precision IEEE 754
- Sign bit: Negative .
- Binary magnitude: .
- Mantissa (): (pad to 23 bits).
- Biased Exponent ():
- 32-bit representation:
5.3 Special Values & Denormalized Numbers
The exponent values and (255 for Single, 2047 for Double) are reserved for special cases:
| Exponent Field () | Mantissa Field () | Value Represented | Description |
|---|---|---|---|
| Signed Zero (determined by Sign bit ) | |||
| Denormalized (Subnormal) Numbers (No hidden 1) | |||
| Any | Normalized Numbers | ||
| Overflow / Infinity | |||
| Not a Number (e.g., , ) |
NOTE
Denormalized numbers allow gradual underflow for values very close to zero by removing the implicit leading .
6. GATE PYQ-Style Solved Questions
Q1) What is the decimal value represented by the 8-bit 2's complement binary pattern 10110100?
Sol -
- Examine MSB: MSB =
1, so the number is negative. - To find its magnitude, take 2’s complement of
10110100:- Bitwise NOT:
01001011 - Add 1:
01001011 + 1 = 01001100
- Bitwise NOT:
- Convert
01001100_2to decimal: - Include negative sign: .
Q2) Two 4-bit signed 2's complement numbers A = 1001 and B = 1011 are added. Determine the result and check if an overflow occurred.
Sol -
- Input values:
- Perform binary addition: \begin{array}{r@{\quad}l} 1001 \\ +\ 1011 \\ \hline (1)0100 \end{array}
- Truncating to 4 bits: Result = .
- Check Overflow:
- Adding two negative numbers () produced a positive result ()!
- Bitwise carry check: Carry into MSB , Carry out of MSB ? Let’s trace:
- Bit 0: , carry =
- Bit 1: , carry =
- Bit 2: , carry =
- Bit 3 (MSB): , carry out
- .
Q3) A single-precision IEEE 754 floating-point variable has the hex representation 0x41400000. Determine its decimal value.
Sol -
- Convert Hex to 32-bit Binary:
- Parse Fields:
- Sign (): Bit 31 =
0Positive (). - Exponent (): Bits 30–23 = .
- Mantissa (): Bits 22–0 = .
- Sign (): Bit 31 =
- Compute Actual Exponent:
- Compute Value: