Back to the 2025 paper

Module 1: Functional Block of computer and Data representaion

20257m

Describe floating point arithmetic and explain overflow, underflow, normalization, and rounding.

Worked SolutionAI Assisted

Floating Point Arithmetic, Overflow, Underflow, Normalization, Rounding

Let X=Mx×2ExX = M_x \times 2^{E_x}, Y=My×2EyY = M_y \times 2^{E_y} (IEEE 754: M=1.fM=1.f normalized).

1. Addition / Subtraction

  1. Align exponents: ΔE=∣Ex−Ey∣\Delta E = |E_x-E_y|, shift smaller mantissa right by ΔE\Delta E: Msmall′=Msmall/2ΔEM_{small}' = M_{small} /2^{\Delta E}, E=max⁡(Ex,Ey)E = \max(E_x,E_y).
  2. Add/Subtract mantissas: M=Mx′±My′M = M_x' \pm M_y'.
  3. Normalize (see below).
  4. Round and re-normalize if carry.

E.g. 1.101×23+1.011×211.101\times2^3 + 1.011\times2^1: Align 1.011×21=0.01011×231.011\times2^1 =0.01011\times2^3, sum =1.11111×23=1.11111\times2^3.

Subtraction similar, may need large normalization if cancellation.

2. Multiplication

M=Mx×MyM = M_x \times M_y (unsigned), E=Ex+Ey−biasE = E_x + E_y - bias (127/1023), sign S=Sx⊕SyS = S_x \oplus S_y.
Product of 1.xxx numbers in [1,4)[1,4) so if M≥2M \ge 2, shift right 1, E++E++.

E.g. 1.5×22×1.25×211.5\times2^2 \times 1.25\times2^1: 1.5×1.25=1.8751.5\times1.25=1.875, E=3E=3 => 1.875×23=151.875\times2^3=15.

3. Division

M=Mx/MyM = M_x / M_y, E=Ex−Ey+biasE = E_x - E_y + bias, S=Sx⊕SyS = S_x \oplus S_y.
If M<1M<1, shift left 1, E−−E--.

4. Overflow

Exponent after operation >Emax> E_{max} (255 bias => actual 127 single /1023 double).
Result magnitude too large to represent => ±Infinity (IEEE) or exception.
E.g. Max single ≈3.4×1038\approx 3.4\times10^{38}; multiplying two large numbers overflows.

Addition/multiplication overflow: exponent carry out; division never overflows unless divisor tiny.

5. Underflow

Exponent <Emin< E_{min} (00 => actual -126 single). Result too close to zero (denormal) => magnitude <1.0×2−126<1.0\times2^{-126}.
Gradual underflow: return subnormal 0.M×2−1260.M \times2^{-126} with loss of precision, or flush to 00.
E.g. 1.0×2−126/2=0.5×2−1261.0\times2^{-126} / 2 =0.5\times2^{-126} underflows to subnormal.

6. Normalization

Keep mantissa in [1.0,2.0)[1.0,2.0): leading bit 1 before binary point (hidden 1).

  • Post-arithmetic normalization:
  • If M≥2.0M \ge 2.0 (e.g. 10.xxx10.xxx), shift right 1, E++E++.
  • If M<1.0M <1.0 (e.g. 0.001xx0.001xx), shift left until 1.xxx1.xxx, E−−E-- each shift.

Maximizes precision and ensures unique representation. Unnormalized example 0.1001×230.1001\times2^3 -> 1.001×221.001\times2^2.

7. Rounding

After normalization mantissa may have >23 bits (guard, round, sticky bits needed). IEEE requires:

  • Truncation/Chop: drop extra bits (biased).
  • Round to nearest even (default IEEE): if >0.5>0.5 ULP round up, if =0.5=0.5 round to make LSB 0.
  • Round toward +∞+\infty / −∞-\infty / toward 0.

Guard (GG), Round (RR), Sticky (SS) bits capture discarded bits to decide rounding without full precision. Incorrect rounding causes accumulated error.

Exception flags: Overflow, Underflow, Inexact (rounding needed), Invalid (0/0), Divide-by-zero.

Similar questions

AI LearningWeb Platform

Coursify — Personal AI Course Generator

Struggling with a difficult subject or concept? Turn any engineering topic into a structured course with interactive lessons, quizzes, and research-backed explanations.