Loading...
A fixed sixteen-bit budget cannot represent every real number. Use neighbouring values to reason about rounding and classify reserved exponent codes before applying a formula.
What you'll be able to do
For normal values sharing actual exponent e, increasing the ten-bit fraction field by one changes the value by 2ᵉ/1024. Between 1 and 2, the gap is 2⁻¹⁰=1/1024. Between 1024 and 2048, the gap is 1. A format’s absolute spacing grows as magnitude grows, even though the count of significant binary digits is unchanged.
A decimal fraction such as 0.1 repeats in binary and must be approximated. In round-to-nearest, ties-to-even mode, choose the nearer representable value; at an exact midpoint choose the one whose retained final significand bit is even, meaning zero. Rounding can propagate a carry into the exponent. These details explain why displaying a decimal value is not proof that its internal binary value is exact.
For E=0 and F=0 the value is signed zero. For E=0 and F greater than zero, a subnormal has no implied leading 1: its magnitude is (F/1024)×2⁻¹⁴. Thus the smallest positive subnormal is 2⁻²⁴, while the smallest positive normal is 2⁻¹⁴. Subnormals allow a gradual approach to zero with reduced relative precision.
For E=31 and F=0 the encoding represents signed infinity. For E=31 and F greater than zero it represents NaN, meaning not a number. These classes are included to complete the format model; Pearson’s core conversion skill is still to construct and decode the specified half-precision representation. A NaN is not a large ordinary finite number.
| Exponent code E | Fraction integer F | Meaning |
|---|---|---|
| 1–30 | 0–1023 | Normal finite: (−1)ˢ(1+F/1024)×2ᴱ⁻¹⁵ |
| 0 | 0 | Signed zero |
| 0 | 1–1023 | Subnormal: (−1)ˢ(F/1024)×2⁻¹⁴ |
| 31 | 0 | Signed infinity |
| 31 | 1–1023 | NaN |
The largest finite positive value uses E=30 and F=1023: (2−2⁻¹⁰)×2¹⁵=65504. A finite result beyond the representable range may overflow; the exact software response depends on the operation and environment. A tiny value may round to a subnormal or zero. A loss of exact digits within the finite range is a precision issue rather than overflow.
For a concrete rounding example, 1+2⁻¹¹ lies halfway between 1 and 1+2⁻¹⁰. Ties-to-even chooses 1, whose retained fraction ends in zero. Halfway between 1+2⁻¹⁰ and 1+2×2⁻¹⁰, the same rule chooses the upper neighbour. Use exact powers of two to reason about these cases; a rounded calculator display can conceal a tie.
Attempt the task before opening its worked response. Record each change of state, explain the rule used, and check the result against the original requirements. Code examples labelled Python 3 use that language’s conventions; pseudocode states its own assumptions.
Common mistakes to avoid
Key takeaways
Test yourself
Answer a few questions, then review anything you missed.
Start with the quiz above to check the key ideas. You can also choose another topic from the practice library.