Representation of Integers, Signed Integers, and Reals (incl. Double Precision)
At a Glance
- Frequency: 1 sub-part across 1 of 13 years (2024)
- Priority tier: T4
- Marks (count): 5 (1)
- Average solve time: ~10 min
- Difficulty mix: medium 1
- Section: A | Dominant type: computation
Why This Chapter Matters
A single 5-mark question from 2024 covers the full spectrum of number representation — unsigned integers, signed integers (2’s complement), and IEEE 754 double-precision floating-point. The marks are quick if the double-precision bit layout is memorised and the bias-1023 formula is applied correctly. This atom is a reliable minimal-effort maximum-marks target.
Minimum Theory
Unsigned Integers
An -bit unsigned integer stores values from to . The value is:
where is the -th bit (LSB = ).
Signed Integers: Three Schemes
| Scheme | Positive | Negative | Range ( bits) |
|---|---|---|---|
| Sign-magnitude | to ; two zeros | ||
| 1’s complement | (bitwise NOT) | to ; two zeros | |
| 2’s complement | to ; one zero |
2’s complement is universal in modern hardware. Its key advantage: ordinary binary addition works for both positive and negative numbers without special cases.
Detecting overflow in 2’s complement addition. Overflow occurs if and only if two numbers of the same sign are added and the result has the opposite sign.
Floating-Point: IEEE 754 Double Precision
Bit layout (64 bits total):
- = sign bit (0 = positive, 1 = negative).
- = biased exponent (11 bits); the stored value is , so the actual exponent is .
- = mantissa (52 bits); the leading 1 is implicit, giving an effective 53-bit significand.
Value of a normalised number ():
where means .
Special values:
| (stored) | Meaning | |
|---|---|---|
| 0 | 0 | |
| 0 | Subnormal: | |
| 2047 | 0 | |
| 2047 | NaN |
Machine epsilon. The smallest such that in double precision:
Converting a decimal to double precision — procedure:
- Determine the sign bit .
- Convert to binary.
- Normalise: write as (shift the binary point so that exactly one 1 is to the left).
- Biased exponent: ; convert to 11-bit binary.
- Mantissa: take the 52 bits after the binary point of , padding with zeros on the right if needed.
Question Archetypes
| Archetype | Recognition |
|---|---|
| decimal-to-double | Represent a given decimal number in IEEE 754 double-precision format |
| interpret-bit-pattern | Given a 64-bit pattern, decode the double-precision value |
| signed-range-or-2s-comp | State the range, or convert a negative number to 2’s complement |
decimal-to-double (1 question; 2024)
Recognition Cues
- “Represent in IEEE 754 double-precision format.”
- “Give the sign, exponent, and mantissa bits.”
Solution Template
- Write (positive) or (negative).
- Convert to binary using repeated multiplication (fractional part) or division (integer part).
- Normalise to .
- Compute biased exponent ; express as 11-bit binary.
- Write the 52 mantissa bits (the fractional part , padded to 52 bits).
- Assemble: .
Worked Example
2024 Paper 2, 2024-P2-Q8a (5 marks)
Represent the decimal number in IEEE 754 double-precision (64-bit) floating-point format. Give the sign bit, biased exponent (in binary), and the first 10 bits of the mantissa.
Step 1 — sign bit.
, so .
Step 2 — convert to binary.
Integer part: .
Fractional part: bit 1; bit 0; bit 1. Stop.
So .
Therefore: .
Step 3 — normalise.
Exponent .
Step 4 — biased exponent.
Convert to 11-bit binary:
Step 5 — mantissa (52 bits).
The fractional part of is . The first 10 mantissa bits are .
Step 6 — assemble.
Common Traps
- Bias is 1023 for double precision, not 127 (which is for single precision / 32-bit).
- The implicit leading 1 is not stored in the mantissa bits. The 52 bits hold only the fractional part after the binary point.
- When the exponent is negative (e.g., ), the biased exponent is still positive: .
- Subnormal numbers (biased exponent = 0) do not have an implicit leading 1; their value is .
- Confusing machine epsilon with the smallest positive double (the latter is the smallest normalised number).
Marks-Aware Writing
At 5 marks, an efficient answer has five numbered steps: sign bit, binary conversion of , normalisation showing , biased exponent computation and conversion to 11-bit binary, and the mantissa bits. Every step must be shown — the examiner cannot award marks for a final bit pattern without the derivation. Stating the IEEE 754 field widths (1-11-52) in the opening line saves you from being penalised for the wrong layout.
Practice Set
Only one historical question on this atom (shown above).