Loading...
A fixed binary point gives each bit a permanent place weight. Determine the representable grid before calculating the error introduced by rounding or truncation.
What you'll be able to do
In fixed-point representation, the binary point has an agreed position rather than being stored as an ordinary digit. Fractional places to its right have weights 1/2,1/4,1/8 and so on. With four fractional bits, adjacent stored values differ by 1/16.
In an eight-bit signed format with four bits before the point, including the sign bit, weights are -8,4,2,1,1/2,1/4,1/8,1/16. Thus 1110.1000 represents -1.5. An unsigned interpretation would use a different leading weight and therefore a different range.
A finite number of binary fractional bits represents a finite grid. Some decimal values, such as 0.5, lie exactly on that grid. Decimal 0.1 has a non-terminating binary expansion and cannot be represented exactly by any finite binary fraction.
Truncation discards unavailable low-order information according to the chosen signed representation rule; rounding chooses a nearby representable value using a stated tie policy. With round-to-nearest and a uniform grid, the maximum ordinary error is half a step, subject to the format’s endpoint and tie conditions.
Absolute error is the magnitude of stored value minus intended value. Relative error divides that absolute error by the magnitude of the intended non-zero value. Multiply by 100 to express it as a percentage. Relative error is undefined under this formula when the intended value is zero.
A small absolute error can be large relative to a small measurement. Keep the reference value and units visible, and do not confuse a signed difference with the non-negative magnitude requested as absolute error. Repeated arithmetic can propagate approximation, so report suitable precision rather than inventing exactness.
| Value | Stored with four fractional bits, nearest | Absolute error |
|---|---|---|
| 3.6 | 3.625 | 0.025 |
| 0.5 | 0.5 | 0 |
| -1.5 | -1.5 | 0 |
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.