AO2, AO3 – implement normalisation after an operation
Special values (zero, denormals, infinities, NaN)
✓
AO1, AO2
Overflow & underflow handling
✓
AO2, AO3 – devise a safe‑guard routine
2. Information Representation (AS 1)
Binary, Octal, Hexadecimal – base‑2, base‑8 and base‑16 systems used for low‑level programming.
BCD (Binary‑Coded Decimal) – each decimal digit stored in a 4‑bit nibble; useful for financial calculations.
ASCII & Unicode
ASCII: 7‑bit code for 128 characters (0‑127).
Unicode (UTF‑8): variable‑length encoding covering world‑wide characters; the first 128 code points are identical to ASCII.
Overflow in integer arithmetic – occurs when the result exceeds the range representable by the chosen number of bits (e.g., 8‑bit two’s complement range –128 … +127).
3. Basic Hardware (AS 2)
CPU components – ALU, control unit, registers, cache.
Round‑down (toward ‑∞) and Round‑up (toward +∞) – useful for interval arithmetic.
During normalisation, any bits that fall off the 23‑bit fraction are examined to decide whether the retained mantissa must be incremented (round‑up) or left unchanged (round‑down).
11. Normalising the Result of an Arithmetic Operation
Example: add A = 1.101 × 2³ and B = 1.001 × 2¹.
Align exponents: shift the mantissa of the smaller exponent (B) right by 2 positions → 0.01001 × 2³.
Add mantissas:1.101 + 0.01001 = 10.11101.
Normalise: result is 1.011101 × 2⁴ (left‑shift once, increase exponent).
Round (if needed): truncate/round to 23 fraction bits.
Pseudocode – Normalise After Addition (single precision)
function normalize(mantissa, exponent):
// mantissa includes extra guard bits (at least 2)
while mantissa >= (1 << (FRAC_BITS+1)): // overflow → left shift
mantissa >>= 1
exponent += 1
while mantissa < (1 << FRAC_BITS): // leading 0 → right shift
mantissa <<= 1
exponent -= 1
// ---- rounding to nearest, ties‑to‑even ----
guard = mantissa & 0b11 // two least‑significant bits
mantissa >>= 2 // drop guard bits
if guard == 0b10 and (mantissa & 1): // tie → make even
mantissa += 1
elif guard > 0b10:
mantissa += 1
// check for a new overflow caused by rounding
if mantissa == (1 << (FRAC_BITS+1)):
mantissa >>= 1
exponent += 1
return mantissa & ((1 << FRAC_BITS)-1), exponent
Constants: FRAC_BITS = 23 for single precision.
12. Precision Loss & Catastrophic Cancellation
When two nearly equal numbers are subtracted, the leading significant bits cancel, leaving only the less‑significant bits and dramatically reducing accuracy.
Operation
Exact Decimal
IEEE‑754 (single) Result
Relative Error
13.625 − 13.624
0.001
0.0009765625 (≈ 2⁻¹⁰)
≈ 2 % error
1.0000001 − 1.0000000
0.0000001
0 (underflow to zero)
100 % loss
Mitigation strategies (AO3):
Re‑order calculations to avoid subtracting nearly equal values.
Use a higher‑precision format (double) when the algorithm is sensitive.
Apply compensated summation (e.g., Kahan algorithm) for large accumulations.
13. Special Cases
Zero:E = 0, F = 0. Sign distinguishes +0 and –0.
Denormalised numbers:E = 0, F ≠ 0. Implicit leading bit is 0, allowing values smaller than the smallest normalised number.
Infinity:E = 255, F = 0. Represents overflow or division by zero.
NaN (Not a Number):E = 255, F ≠ 0. Result of undefined operations (e.g., 0/0, √‑1).
14. Overflow & Underflow Handling (AO3)
Overflow: if the exponent after normalisation exceeds the maximum (254 for single), set the result to ∞ with the appropriate sign.
Underflow: if the exponent drops below the minimum normalised value (‑126), the number becomes denormalised; if it falls below ‑149, it rounds to zero.
Typical safe‑guard routine (pseudocode):
if exponent > MAX_EXP: // 254
result = (sign ? -INF : INF)
elif exponent < MINNORMALEXP: // -126
shift = MINNORMALEXP - exponent
mantissa >>= shift // create denormal
exponent = 0
if mantissa == 0:
result = (sign ? -0.0 : 0.0)
15. Mapping to Assessment Objectives
AO
What the Student Must Do
AO1
Recall the binary, octal, hexadecimal, BCD, ASCII/Unicode formats; the IEEE‑754 layout; bias, hidden bit and special values.
AO2
Convert between bases, normalise a given decimal number, analyse precision loss, identify overflow/underflow and explain hardware/communication relevance.
AO3
Design short algorithms (pseudocode) that normalise a floating‑point result, choose a rounding mode, and handle overflow/underflow; propose a network‑topology choice for a given scenario.
16. Key Points to Remember
Normalisation forces the mantissa to start with a hidden 1 (except for denormals).
The exponent is stored with a bias (127 for single, 1023 for double) to allow both positive and negative powers.
Rounding after normalisation can change the exponent again – always re‑check for overflow.
Precision is limited by the number of fraction bits; catastrophic cancellation is a common source of error.
Understanding normalisation is essential for debugging arithmetic, implementing custom floating‑point routines, and for AO3‑type programming questions.
Basic hardware concepts (logic gates, registers) and communication fundamentals (topologies, IP addressing) are required background for the whole syllabus.
Suggested diagram: Flowchart of the normalisation process – conversion → shift → exponent bias → fraction field → rounding → special‑case handling.