Floating-Point Representation
Floating-Point Numbers
A2-Level Topic 13: Advanced Data Representation
1. The Structure
A floating-point number is split into two parts: the Mantissa and the Exponent. Both are usually stored in Two's Complement form.
Value = Mantissa × 2Exponent
Example: 8-bit Mantissa and 4-bit Exponent
2. Normalization
To ensure maximum precision and a unique representation for every number, we Normalize floating-point numbers. A normalized number must start with:
- 01 for a positive number.
- 10 for a negative number.
This ensures the binary point is always immediately after the sign bit.
3. Precision vs. Range
Computers have a fixed number of bits (e.g., 32-bit or 64-bit). There is always a trade-off:
- More bits for Mantissa = Higher Precision (more decimal places).
- More bits for Exponent = Larger Range (huge or tiny numbers).
A-Level Floating Point Lab
Explore the trade-off between Precision and Range.
4. Errors in Floating Point
- Overflow: The number is too large to be represented by the exponent.
- Underflow: The number is too small (closer to zero) to be represented.
- Rounding Error: Some numbers (like 0.1) cannot be represented exactly in binary, leading to tiny inaccuracies in calculations.
You will often be asked to "Normalize the following floating-point number." This involves shifting the binary point and adjusting the exponent accordingly. Remember: Shifting the Mantissa Left means Subtracting from the Exponent.