Back to course

Floating-Point Representation and Normalisation

Original academy material

Free preview lesson. Enrol in ZIMSEC A-Level Computer Science (6023) to unlock every lesson, save your progress and earn your certificate. See the course

Text size

LEARNING OBJECTIVES

  • Define the structure of floating point numbers.
  • Convert decimal numbers into binary floating point format.
  • Explain the process of normalisation.
  • Identify the cause of rounding errors in computers.
  • Calculate values from a given binary bit pattern.

IN SIMPLE TERMS

This lesson explains how computers store very large or very small numbers. Normal computers cannot store every number exactly. Instead, they use a system similar to scientific notation. This method splits a number into a mantissa, which holds the digits, and an exponent, which shows the position of the decimal point.

You need this skill for your ZIMSEC Paper 1 exam. Examiners frequently ask you to convert numbers or fix errors in bit patterns. Learning this properly ensures you gain marks that many students lose by rushing or making simple mistakes during their calculations.

Use the materials below to practice your steps. Read each concept carefully and try the example problems on your own before looking at the answers. Take your time to understand how the bits move. If you get stuck, look at the key terms list to remind yourself what the parts mean.

KEY TERMS YOU MUST KNOW

  • Floating point: A way to represent numbers where the decimal point can move to handle very large or small values.
  • Mantissa: The part of the floating point number that contains the main digits or significant numbers.
  • Exponent: The part of the number that tells the computer where to place the decimal point.
  • Normalisation: A process of adjusting the mantissa so the number starts with 0.1 for positive or 1.0 for negative values.
  • Two's complement: A common method for representing negative numbers in binary code.
  • Rounding error: A small inaccuracy that happens when a computer cannot store a number perfectly because it has too many digits.
  • Bit pattern: The specific sequence of ones and zeros used to store data in the computer memory.

INTRODUCTION

Welcome to this lesson on Floating-Point Representation and Normalisation. As a ZIMSEC A-Level Computer Science student, you have likely encountered fixed-point numbers, which are intuitive but limited. In reality, computers must represent a vast range of values, from the microscopic size of an atom to the astronomical scale of the universe. Floating-point representation is the standard way to handle this. It is a critical topic in Paper 1 and often appears as a calculation-heavy question. Examiners love this topic because it tests your attention to detail and your ability to follow logical steps under pressure. Mastering this will guarantee you a significant chunk of marks that many students unfortunately throw away due to careless errors.

KEY CONCEPTS

Floating-point representation mimics scientific notation (like 3.0 x 10^8) but uses binary. A floating-point number is split into two main parts: the mantissa and the exponent.

The mantissa is the significant digits of the number. It represents the actual value being stored. In ZIMSEC A-Level, the mantissa is almost always represented using Two's Complement. This allows for both positive and negative values.

The exponent indicates where the binary point is located. By increasing or decreasing the exponent, you shift the binary point left or right, which is why we call it a floating-point number.

1618041211010110₂ = 16 + 4 + 2 = 22
In base 2 (binary), each place is a power of 2 instead of 10: 16, 8, 4, 2, 1. The number 10110 has a 1 in the 16, 4 and 2 places, so its value is 16 + 4 + 2 = 22 in denary.

The diagram above represents the standard 16-bit floating-point format often used in ZIMSEC exams. Typically, the first 8 bits are allocated to the mantissa (including the sign bit) and the last 8 bits to the exponent. The mantissa uses the first bit as the sign bit (0 for positive, 1 for negative). The remaining 7 bits represent the fractional value, with the binary point implicitly placed after the first bit (the sign bit).

Normalisation is the process of ensuring that a floating-point number is stored in the most precise way possible. A number is normalised if the mantissa starts with 01 (for a positive number) or 10 (for a negative number). If the mantissa does not follow this pattern, it is unnormalised, meaning you are wasting bits and losing precision. To normalise, you must shift the bits of the mantissa left or right and adjust the exponent accordingly to ensure the value remains unchanged.

WORKING EXAMPLE ONE

Question: Represent the decimal value 0.625 as a normalised 16-bit floating-point number. Use 8 bits for the mantissa and 8 bits for the exponent.

Step 1: Convert the decimal to binary. 0.625 is 0.5 (2^-1) + 0.125 (2^-3). This is 0.101 in binary.

Step 2: Place the binary point. We need the form 0.101. To normalise, it must start with 01. Since 0.101 already starts with 01, it is already normalised.

Step 3: Write the mantissa. We have 8 bits. The first bit is the sign (0). The remaining 7 bits are 1010000. So the mantissa is 01010000.

Step 4: Determine the exponent. The binary point was moved 0 places (it was already at the correct position 0.101). The exponent is 0. In 8-bit binary, 0 is 00000000.

Step 5: Combine. The result is 01010000 00000000.

WORKING EXAMPLE TWO

Question: Normalise the following 16-bit number: 00010100 00000010.

Step 1: Identify the mantissa. It is 00010100.

Step 2: Check for normalisation. A positive mantissa must start with 01. Currently, it starts with 00. This is unnormalised.

Step 3: Shift the mantissa. Shift left by one position to get 0010100x. To keep the value the same, we must decrease the exponent by 1.

Step 4: Adjust the exponent. The original exponent was 00000010 (decimal 2). Decreasing it by 1 gives 00000001 (decimal 1).

Step 5: The new mantissa is 00101000. The result is 00101000 00000001.

WORKING EXAMPLE THREE

Question: Convert a negative number. Represent -0.75 as a 16-bit normalised floating-point number.

Step 1: Find binary of 0.75. 0.5 + 0.25 = 0.11.

Step 2: Find two's complement of the mantissa. First, get the positive version: 0.1100000. Now flip bits and add 1. Flip: 1.0011111. Add 1: 1.0100000.

Step 3: Check normalisation. A negative number must start with 10. Our mantissa is 1.0100000. It starts with 10. It is normalised.

Step 4: Exponent is 0 (00000000).

Step 5: Result is 10100000 00000000.

EXAMINER TRAPS

  • Confusing the Mantissa and Exponent bits: Always read the question to see how many bits are allocated to each. If you get this wrong, the rest of the answer is forfeit.
  • Forgetting the Two's Complement: When dealing with negative numbers, students often just flip the sign bit and leave the rest of the bits unchanged. You must perform the full two's complement operation on the entire mantissa.
  • Misinterpreting the implicit binary point: Remember that in the mantissa, the binary point is effectively between the first and second bits.
  • Failing to adjust the exponent: When shifting the mantissa left or right, students often forget to modify the exponent. Remember the golden rule: shift the mantissa left, decrease exponent; shift right, increase exponent.
  • Assuming 0.0 is always normalised: The number 0 is the exception to the normalisation rule. It is stored as all zeros. Do not try to force a 01 or 10 pattern on a zero value.
  • Miscounting bits: If you are told to use 8 bits for the mantissa, ensure you actually write 8 bits. Pad with zeros if necessary.

PAST-PAPER STYLE WALKTHROUGH

Question: A computer uses 12 bits for a floating-point representation, with 4 bits for the exponent and 8 bits for the mantissa. Represent the value 0.25 in this format.

Step 1: Analyse the requirements. Total bits: 12. Exponent: 4 bits. Mantissa: 8 bits.

Step 2: Convert 0.25 to binary. This is 2^-2, which is 0.01 in binary.

Step 3: Normalise. We need the mantissa to start with 01. Currently, it is 0.01. To make it 0.10, we shift the mantissa left by one bit.

Step 4: Calculate the new exponent. Since we shifted the mantissa left by one, the exponent must be -1.

Step 5: Write the -1 exponent in 4-bit two's complement. 1 is 0001. Flip bits: 1110. Add 1: 1111.

Step 6: Write the mantissa. We shift 0.01 left to become 0.10. With 8 bits, this is 01000000.

Step 7: Final check. Mantissa: 01000000. Exponent: 1111. Final answer: 01000000 1111.

Tip: Always perform a quick check by converting your binary back to decimal to see if it matches the original question. If you are wrong, you have time to adjust your mantissa or exponent before moving to the next question.
Tip: Use a pencil to mark the positions of the bits to avoid counting errors during the exam.
Tip: Pay attention to the range provided by the exponent. A 4-bit exponent has a limited range. Ensure your shifted exponent fits within the available bits.

SUMMARY

Floating-point representation is the backbone of how computers handle real numbers. You have learned that the mantissa holds the precision while the exponent holds the range. Normalisation is the technique used to ensure that the maximum possible precision is extracted from the available bits by ensuring the mantissa follows a strict 01 or 10 start sequence. By practicing the shifting of bits and adjusting the exponent alongside the rigours of two's complement, you are prepared to handle the most complex arithmetic questions on the ZIMSEC paper. Always remember to check your work, count your bits twice, and never forget that a shift in the mantissa must always be balanced by a reciprocal move in the exponent. Practice these steps until they become mechanical; this is the key to passing this section with full marks.

Quick check

1. In two's complement floating-point representation with an 8-bit mantissa and a 4-bit exponent, what is the primary purpose of normalisation?
2. Which mantissa bit pattern indicates a normalised positive floating-point number in two's complement?
3. What occurs during an arithmetic underflow condition in floating-point operations?
4. Convert the denary fraction -3.75 into a normalised 8-bit mantissa and 4-bit exponent two's complement format.
5. A system uses an 8-bit mantissa and a 4-bit exponent, both in two's complement. What is the denary value of the binary floating-point pattern 10100000 0011?
6. Why does normalising a negative two's complement floating-point number require the first two bits of the mantissa to be '10'?
7. What is the effect of increasing the bit allocation for the mantissa from 8 bits to 12 bits while reducing the exponent from 8 bits to 4 bits?
8. A floating-point addition of 0.125 and 128.0 is attempted in a system with an 8-bit mantissa. What error best characterises the loss of 0.125?
9. Calculate the absolute error when the denary value 0.2 is approximated using an 8-bit normalised mantissa (01100110) and an exponent of 0000 (2^0).
10. Which representation shows the largest positive normalised value possible in an 8-bit mantissa and 4-bit exponent (both two's complement)?
11. A 16-bit floating-point system uses an 8-bit mantissa and an 8-bit exponent, both in two's complement. If a calculation results in a mantissa of 0.0011000 and an exponent of 00000010, why is this result considered unnormalised?
12. When normalising the negative binary value 1.1010000, what happens to the exponent if you shift the mantissa one position to the left?
13. In a system with a 6-bit mantissa (including sign) and a 4-bit exponent, what is the maximum number of distinct values that can be represented if all numbers are strictly normalised?
14. If a computer performs a floating-point operation and the result is too small to be represented (e.g., 0.000000001), what is the most likely outcome?
15. Consider a 4-bit mantissa (including sign) and a 3-bit exponent. Which of these is a valid normalised negative number?