CS  ·  Computer Systems

Floating Point Representation

Lesson CS1b of 11 Approx 60 min Requires: CS1 (binary & denary)
Learning intentions
  • Understand why computers need floating point to represent real numbers
  • Identify and describe the mantissa and exponent parts of a floating point number
  • Convert positive real numbers between denary and binary floating point format
Success criteria
  • I can explain what the mantissa and exponent represent
  • I can convert a positive real number into normalised binary floating point
  • I can decode a floating point bit pattern to find the real number it represents
  • I can explain why normalisation is used and what it achieves
Warm up — what do you already know?

Answer before the lesson begins. These check prior knowledge — it's fine if you're unsure.

1. In binary, the position immediately after the binary point (the first fractional digit) has the value:

2. What is the binary fraction 0.11 equal to in denary?

3. A floating point number in binary is made up of two parts. What are they called?

Key vocabulary

floating point
A way to store real numbers (numbers with a fractional part) in binary, using a mantissa and an exponent.
mantissa
The significant digits part of a floating point number. Stored as a binary fraction (e.g. 0.11010000).
exponent
The power of 2 that the mantissa is multiplied by. Controls how large or small the number is.
normalised form
A floating point representation where the mantissa starts with 0.1… — the first bit after the binary point is always 1.
binary fraction
A binary number with digits after the binary point. Each position = 1/2, 1/4, 1/8, … (powers of 2 with negative exponents).
real number
A number that can have a fractional part, e.g. 6.5 or 13.25. Integers cannot represent these precisely without floating point.
precision
How many significant digits a floating point number can store. More mantissa bits → more precision.
range
The spread of values a floating point format can represent. More exponent bits → larger range.

Floating Point Representation

Why integers are not enough

You already know that computers store whole numbers (integers) in binary using place values: 128, 64, 32, 16, 8, 4, 2, 1. This works perfectly for numbers like 42 or 200, but what about numbers like 6.5 or 13.25? Integers have no way to represent the part after the decimal point. Computers need a different system for real numbers — numbers that include a fractional part — and that system is called floating point.

Binary fractions

Just as the integer place values go 128, 64, 32, 16, 8, 4, 2, 1 (powers of 2 counting up), fractional place values continue the pattern in the other direction after the binary point:

Position 22 21 20 binary point 2−1 2−2 2−3 2−4
Value 4 2 1 . 0.5 0.25 0.125 0.0625

So the binary number 110.1 means: 4 + 2 + 0.5 = 6.5. And 1101.01 means: 8 + 4 + 1 + 0.25 = 13.25.

The two parts: mantissa and exponent

A floating point number is stored as two separate values:

  • Mantissa — the significant (meaningful) digits, stored as a binary fraction
  • Exponent — a binary integer that says how far to shift the binary point

The real value is calculated as: mantissa × 2exponent. You can think of the exponent as a "zoom factor" — it scales the mantissa up or down by moving the binary point left or right.

Normalised floating point

Any number can be written in floating point in many different ways. For example, 6.5 could be 0.1101 × 23, 0.01101 × 24, or even 0.001101 × 25. To avoid ambiguity and to make the most of the available bits, computers always use normalised form.

A floating point number is normalised when the mantissa begins with 0.1 — meaning the very first bit after the binary point is always 1. This guarantees:

  • Uniqueness — each real number has exactly one floating point representation
  • Maximum precision — no bits are wasted on unnecessary leading zeros in the mantissa

Converting a real number to floating point

The process has three steps:

  1. Convert to binary — write the whole part and fractional part separately, then combine
  2. Normalise — move the binary point left until the mantissa is in the form 0.1…, counting how many places you moved (that count becomes the exponent)
  3. Fill the fields — write the mantissa bits (padding with trailing zeros if needed) and the exponent in binary

Decoding floating point back to a real number

Given a mantissa and exponent, reverse the process:

  1. Read the exponent to find the power of 2
  2. Shift the mantissa binary point that many places to the right
  3. Read off the resulting binary number and convert to denary

Precision vs. range trade-off

Every floating point format has a fixed total number of bits shared between the mantissa and exponent. Giving more bits to the mantissa increases precision (more decimal places can be stored accurately). Giving more bits to the exponent increases range (larger and smaller numbers can be represented). Designers must choose a balance depending on the application — scientific computing often needs wide exponents for enormous numbers, while financial software needs high-precision mantissas.

Worked examples

Example 1 — Convert 6.5 to floating point (8-bit mantissa, 8-bit exponent)
Floating point structure: 8-bit mantissa 11010000, 8-bit exponent 00000011 1 1 0 1 0 0 0 0 | 0 0 0 0 0 0 1 1 represents 0.11010000 represents 3 (= 2+1) Value = 0.11010000 × 2³ = 110.10000 = 6.5
1
Convert 6.5 to binary. Whole part: 6 = 4+2 = 110. Fractional part: 0.5 = ½ = 0.1. Combined: 110.1
2
Normalise. Move the binary point 3 places left so the number reads 0.1101. The exponent is 3 (the number of places moved).
3
Fill the mantissa field (8 bits). The digits after the 0. are 1101 — pad with trailing zeros to fill 8 bits: 11010000
4
Fill the exponent field (8 bits). Exponent = 3 in binary: 00000011
5
Verify. 0.11010000 × 2³ → shift point 3 right → 110.10000 = 4+2+0.5 = 6.5 ✓
Subtraction trace (fractional part): 0.5 → place value 2−1 = 0.5  ✓    Integer: 6 − 4 = 2 − 2 = 0
Example 2 — Convert 13.25 to floating point (8-bit mantissa, 8-bit exponent)
Floating point structure: 8-bit mantissa 11010100, 8-bit exponent 00000100 1 1 0 1 0 1 0 0 | 0 0 0 0 0 1 0 0 represents 0.11010100 represents 4 (= 4) Value = 0.11010100 × 2⁴ = 1101.0100 = 13.25
1
Convert 13.25 to binary. Whole part: 13 = 8+4+1 = 1101. Fractional part: 0.25 = ¼ = 0.01. Combined: 1101.01
2
Normalise. Move the binary point 4 places left: 0.110101. Exponent = 4.
3
Fill the mantissa (8 bits). Digits after 0. are 110101 — pad to 8 bits: 11010100
4
Fill the exponent (8 bits). 4 in binary: 00000100
5
Verify. 0.11010100 × 2⁴ → shift point 4 right → 1101.0100 = 8+4+1+0.25 = 13.25 ✓
Example 3 — Decode: mantissa 10110000, exponent 00000010
1
Read the exponent. 00000010 in binary = 2. So we multiply the mantissa by 22.
2
Write out the mantissa as a fraction. The stored bits 10110000 represent 0.10110000 in binary (the 0. is always implied).
3
Shift the binary point 2 places right (because exponent = 2): 0.1011000010.110000
4
Convert to denary. 10.110000 = 2 + 0.5 + 0.25 = 2.75 ✓
Fraction place values: 0.10110000
position 1 (½): 1 → 0.5    position 2 (¼): 0 → 0    position 3 (⅛): 1 → 0.125? — wait, shift first!
After shifting 2 right: 10.110000 → integer part 102 = 2, fraction 0.11 = 0.5+0.25 = 0.75 → total = 2.75
Now you try

Convert 10.5 to floating point using an 8-bit mantissa and 8-bit exponent. Show all steps.

Answer the following:

  1. What is 10.5 written as a binary number?
  2. What is the normalised mantissa (as 8 bits) and what is the exponent?
  3. Verify your answer by decoding it back to denary.
  1. 10.5 in binary: 10 = 8+2 = 1010; 0.5 = 0.1 → combined: 1010.1
  2. Normalise: move the binary point 4 places left → 0.10101 × 24. Mantissa (8 bits): 10101000. Exponent (8 bits): 00000100 (= 4)
  3. Verify: 0.10101000 × 24 → shift 4 right → 1010.1000 = 8+2+0.5 = 10.5 ✓
Common mistakes
Forgetting to normalise. Simply writing the binary number into the mantissa field without moving the point gives the wrong exponent and wastes mantissa bits on leading zeros. Always move the point until you get 0.1…
Confusing mantissa and exponent. The mantissa is the significant digits (the fraction); the exponent is the scale factor (the power of 2). They are different things stored in different fields.
Thinking 0.1 in binary = 0.1 in denary. It does not. 0.1 in binary = 0.5 in denary (it is 2−1). Binary fractions and decimal fractions are completely different.
Not padding with trailing zeros. If the mantissa bits only fill 5 of the 8 positions, pad with zeros on the right. e.g. 110.1 → normalised mantissa digits 1101 → stored as 11010000 not just 1101.
Exam tip

Always show your working in three clear stages:

  1. Convert to binary (show integer part and fractional part separately)
  2. Normalise (write out the shifted form and state the exponent)
  3. Verify (shift the point back and confirm you recover the original number)

The SQA awards marks for correct working even if you make an arithmetic slip — so a well-labelled multi-step answer scores more than a bare answer with no working shown.

Example exam phrasing: "Explain what is meant by normalised floating point." — state that the mantissa is stored in the form 0.1…, that this ensures uniqueness, and that it maximises precision by eliminating leading zeros.

Task Set

Questions 1–5 are auto-checked. Questions 6–9 are self-marked — write your answer, then reveal the model answer to check your work.

1. The number 6.5 is stored in normalised floating point. What are the 8 mantissa bits? TYPE 1

2. To store 13.25 in normalised floating point, the binary point is shifted 4 places left. This means the exponent stored is: TYPE 1

3. A floating point number has mantissa 11100000 and exponent 00000011 (= 3). What real number does this represent? TYPE 1

4. What are the 8 mantissa bits when storing the number 3.0 in normalised floating point? TYPE 1

5. A number is stored with mantissa 10110000 and exponent 00000010 (= 2). What real number is this? TYPE 1

6. Explain what is meant by "normalised" floating point, and state why normalisation is used. TYPE 2

Model answer: A normalised floating point number is one where the mantissa is stored in the form 0.1… — the first bit immediately after the binary point is always 1. Normalisation is used because it ensures each real number has exactly one binary floating point representation (uniqueness), and it maximises precision by using all mantissa bits for significant digits rather than wasting them on leading zeros.

7. Convert 1.5 to normalised binary floating point using an 8-bit mantissa and 8-bit exponent. Show all steps. TYPE 2

Model answer:

Step 1 — Convert to binary: 1.5 = 1 + 0.5 = 1.1 in binary.

Step 2 — Normalise: move binary point 1 place left → 0.11 × 21. Exponent = 1.

Step 3 — Mantissa (8 bits): 11000000   Exponent (8 bits): 00000001

Verify: 0.11000000 × 211.1000000 = 1 + 0.5 = 1.5 ✓

8. A floating point number is stored with mantissa 10101000 and exponent 00000100. Show your working to find the real number it represents. TYPE 2

Model answer:

Exponent: 00000100 = 4, so multiply by 24.

Mantissa as fraction: 0.10101000

Shift binary point 4 places right: 1010.1000

Convert: 8 + 2 + 0.5 = 10.5

9. A computer uses a 16-bit floating point format. One design uses 12 bits for the mantissa and 4 bits for the exponent. Another uses 8 bits for the mantissa and 8 bits for the exponent. Explain the effect of each choice on precision and range. TYPE 3

Model answer: The 12-bit mantissa / 4-bit exponent design has higher precision — more mantissa bits means more significant digits can be stored, so numbers like 0.000000001 can be represented accurately. However, the 4-bit exponent limits the range — only exponents 0 to 15 are possible, so very large or very small numbers cannot be stored.

The 8-bit mantissa / 8-bit exponent design has a much larger range — the exponent can be up to 255, allowing enormous numbers. However, precision is lower — only 8 significant bits are available, so fine detail in fractional values may be lost.

Teacher notes — Shift+T to hide

Suggested timing: 60 minutes. Warm-up 10 min; binary fractions table + notes 15 min; worked examples (live demo on board) 15 min; now-you-try 5 min; task set 15 min.

Key misconception to address: Pupils frequently confuse 0.1 (binary) with 0.1 (denary). Emphasise early that the binary point works exactly like the decimal point, just with powers of 2. Write the fraction place-value table on the board before the examples.

Live demo suggestion: Show the normalisation process physically — write a number on the board, then literally draw an arrow showing the binary point moving left, counting the moves aloud. This makes the exponent counting concrete.

Extension question: What happens if two different bit patterns decode to the same real number (i.e. the format is not normalised)? Why is this a problem for a computer doing arithmetic?

SQA command words covered: "identify" (parts of floating point), "explain" (normalisation, precision/range), "convert" (denary ↔ floating point binary).

Spec reference: SQA N5 Computing Science — Computer Systems — Data representation — "Floating point representation (mantissa and exponent) for positive real numbers."