Teachers' Portal  /  A-Level Computer Science 9618  /  Data representation  /  Floating-point binary representation
Lesson pack · A-Level Computer Science 9618 · 13.3 · A Level (A2)

Floating-point binary representation

Let the point float. A floating-point number is stored as a mantissa and an exponent, both in two's complement, just like scientific notation in binary.

Student lesson Lab, full screen
At a glance

The shape of the lesson

Topic
Data representation
Syllabus reference
Cambridge International AS and A Level Computer Science 9618, 13.3
Level
A Level (A2)
Duration
45 minutes, lab-led; stretches to a 60 minute block (see the contingency notes)
Position in topic
Lesson 3 of 4 in Data representation; follows File organisation, access and hashing; leads into Normalisation, range and precision
Central model
Fig. 1: an 8-bit mantissa and 4-bit exponent representing 5.5
Cooperative structure
Assessment
Stage 1 check and the exam-style plenary from the student lesson, plus the worksheet as the exit task
Learning objectives

By the end of the lesson, learners can

Section by section
  • The format: In fixed point the binary point is in the same place for every number, so a few bits give either a small range or poor precision.
  • Floating point to denary: Work out the exponent first, then either move the binary point that many places or multiply the mantissa's value by the power of 2.
  • Denary to floating point: Write the number in binary, then slide the point until the mantissa starts 0.1 (positive).
Key points to leave on the board
  • Value = mantissa × 2exponent; both in two's complement.
  • Mantissa place values: −1 . ½ ¼ 1/8 ...; the point follows the first bit.
  • To denary: exponent, mantissa, multiply (or move the point); show each step.
  • From denary: binary, slide the point to 0.1, count places for the exponent; negate the mantissa for negatives and check it starts 10.
The core visual model

One picture every idea returns to

A floating-point number is stored as mantissa × 2exponent. The mantissa holds the significant digits and the exponent says how many places the binary point moves. In 9618 both are in two's complement, and the binary point sits just after the first bit of the mantissa, so the mantissa's place values are −1, ½, ¼, 1/8 and so on. A positive exponent moves the point to the right (a bigger number); a negative exponent moves it to the left (a smaller number). With the same number of bits, floating point gives a far wider range than fixed point.

8-bit mantissa and 4-bit exponent, both in two’s complement −1½¼1/81/161/321/641/128 −8421 01011000 0011 binary point Mantissa Exponent Mantissa = ½ + 1/8 + 1/16 = 0.6875 Exponent = 2 + 1 = 3 Value = 0.6875 × 2³ = 5.5 or move the point 3 places right: 0.1011 → 101.1 = 5.5
Fig. 1: an 8-bit mantissa and 4-bit exponent representing 5.5
Lesson sequence

Forty-five minutes, phase by phase

TimePhaseWhat happens in the roomGrouping
0 to 5 minHook: predictOpen with the question in the title, Let the point float.. A floating-point number is stored as a mantissa and an exponent, both in two's complement, just like scientific notation in binary. Put the figure on the board: it is the one picture every idea in the lesson returns to.Whole class, then pairs
5 to 13 minTeach and check: The formatIn fixed point the binary point is in the same place for every number, so a few bits give either a small range or poor precision. Project tab 5 of the lab (Two's complement: read the bits) and let a student drive it while the class predicts.Whole class, then pairs
13 to 21 minTeach and check: Floating point to denaryWork out the exponent first, then either move the binary point that many places or multiply the mantissa's value by the power of 2. Model the worked example Negative mantissa on the board, one line at a time. Your turn: Convert 10110000 1111 to denary.Pairs
21 to 30 minTeach and check: Denary to floating pointWrite the number in binary, then slide the point until the mantissa starts 0.1 (positive). Model the worked example Positive number on the board, one line at a time. Your turn: Show 0.15625 with an 8-bit mantissa and a 4-bit exponent.Numbered Heads Together
30 to 36 minCheckThe four Stage 1 questions from the student lesson, answered on mini whiteboards or by show of fingers. Re-teach the one most get wrong.Individual, then whole class
36 to 43 minPlenaryThe exam-style questions from Stage 2, one at a time: thirty seconds alone, then a random call. The feedback lines in the key give the examiner's wording.Individual, random call
43 to 45 minExit and homeworkSet the worksheet below (6 questions, 18 marks). Learners self-assess against the objectives before they leave.Individual
Timing and contingency

Protect the parts that carry the learning

The sequence carries about fifty minutes of material, so the lab is driven by one student while the class predicts rather than explored freely. Times are a guide.

Protected: the check at 30 minutes. It is the only individual read on whether the key idea landed, and it is not cut.

Cut first if the build overruns: the last check in Denary to floating point, never the check or the plenary.

In a 60 minute block: run worksheet questions 1 to 3 in class as a Rally Coach set and model both the hardest worked example and its check live.

Running the cooperative task

Numbered Heads Together

Teams of four number off. Put up a question, give the team time to make sure every member can answer, then call a number: that student answers for the team, so nobody can leave the thinking to someone else.

The full structure, with its variations and the other twelve, is on the cooperative-learning page.

Examiner traps to pre-empt

What to head off, and how

Trap learners fall intoTeaching move that pre-empts it
Do not treat the mantissa as a whole number. 01011000 is not 88: the point sits after the first bit, so it is 0.1011000 = 0.6875.Return to The format: ask a pair to state the correct version and show it on the lab before moving on.
Negating a mantissa can leave it starting 11.For −4: 4 = 0.1 × 2 3, so 01000000 0011 negates to 11000000 0011, which is not normalised. Shift left once and reduce the exponent: the correct answer is 10000000 0010.
Worksheet

Floating-point binary representation: worksheet

6 questions, 18 marks. Written in the style of the papers; no past paper question is reproduced.

NameClassDate
Q1 · recall[2 marks]

Describe how a real number is represented in binary floating-point form.

Q2 · convert[3 marks]

A floating-point number uses an 8-bit mantissa and a 4-bit exponent, both in two's complement. Convert 10110000 0010 to denary. Show your working.

Q3 · convert[3 marks]

Using the same format, convert 01001000 1101 to denary.

Q4 · convert[3 marks]

Show the denary number 7.75 as a normalised floating-point number with an 8-bit mantissa and a 4-bit exponent.

Q5 · convert[4 marks]

Show the denary number -0.375 as a normalised floating-point number with an 8-bit mantissa and a 4-bit exponent.

Q6 · convert[3 marks]

A different system uses a 10-bit mantissa and a 6-bit exponent, both in two's complement. Convert 0101100000 000100 to denary.

Answer key and marking notes
Q1 · 2 marks
  • As a mantissa and an exponent, both stored in two's complement; value = mantissa × 2exponent.
  • The mantissa holds the significant digits (with the binary point after its first bit); the exponent gives the number of places the binary point moves.
Q2 · 3 marks
  • Exponent 0010 = 2.
  • Mantissa = -1 + 0.25 + 0.125 = -0.625.
  • -0.625 × 22 = -2.5.
Q3 · 3 marks
  • Exponent 1101 = -8 + 4 + 1 = -3.
  • Mantissa 0.1001 = 0.5 + 0.0625 = 0.5625.
  • 0.5625 × 2-3 = 0.0703125.
Q4 · 3 marks
  • 7.75 = 111.11.
  • = 0.11111 × 23.
  • Mantissa 01111100, exponent 0011.
Q5 · 4 marks
  • 0.375 = 0.011 = 0.11 × 2-1, so the positive mantissa is 01100000.
  • Two's complement of the mantissa: 10100000.
  • Exponent -1 = 1111.
  • Answer 10100000 1111 (check: -0.75 × 0.5 = -0.375).
Q6 · 3 marks
  • Exponent 000100 = 4.
  • Mantissa 0.101100000 = 0.5 + 0.125 + 0.0625 = 0.6875.
  • 0.6875 × 24 = 11 (or move the point: 01011.00000 = 11).
Quiz

6 multiple-choice questions on this lesson

From the topic question bank. Assign them in the app for a marked score in your gradebook, or run the topic as a class game.

Q11 mark

A floating-point number has an 8-bit mantissa and a 4-bit exponent, both in two's complement. What is the denary value of 01101000 0010?

  • A3.25
  • B6.5
  • C1.625
  • D0.8125
Q21 mark

Using the same format, what is the denary value of 10110000 0011?

  • A-5
  • B-3
  • C11
  • D-2.5
Q31 mark

Using the same format, what is the denary value of 01010000 1101?

  • A0.078125
  • B0.01953125
  • C5
  • D5120
Q41 mark

In this two's complement floating-point format, what tells you that the number represented is negative?

  • AThe first bit of the mantissa is 1
  • BThe first bit of the exponent is 1
  • CThe last bit of the mantissa is 1
  • DThe exponent is larger than the mantissa
Q51 mark

Which of these is the denary number -2.75 as a normalised floating-point number with an 8-bit mantissa and a 4-bit exponent, both in two's complement?

  • A10101000 0010
  • B11011000 0010
  • C10100111 0010
  • D10101000 1110
Q61 mark

Which is the denary number 0.09375 as a normalised floating-point number with an 8-bit mantissa and a 4-bit exponent, both in two's complement?

  • A01100000 1101
  • B00110000 1110
  • C01100000 0011
  • D01100000 1011
Quiz key
Q1: A

The exponent 0010 is +2. The mantissa 0.1101000 is ½ + ¼ + 1/16 = 0.8125, and 0.8125 × 22 = 3.25 (moving the point gives 11.01). 6.5 moves the point 3 places, 1.625 moves it only 1 place, and 0.8125 is the mantissa alone, with the exponent ignored.

Q2: A

The exponent 0011 is +3. The mantissa is -1 + ¼ + 1/8 = -0.625, and -0.625 × 8 = -5. -3 treats the first bit as a minus sign in front of 0.0110000 (sign and magnitude), 11 reads the mantissa as unsigned 1.011, and -2.5 uses an exponent of 2 instead of 3.

Q3: A

The exponent 1101 is -8 + 4 + 1 = -3. The mantissa 0.101 is 0.625, and 0.625 × 2-3 = 0.078125. 0.01953125 reads 1101 as -5 (sign and magnitude), 5 uses an exponent of +3, and 5120 reads the exponent as unsigned 13.

Q4: A

The mantissa's first bit has place value -1, so a mantissa starting 1 is negative and so is the whole number. A negative exponent (first exponent bit 1) only makes the number small, as in 0.078125. The last mantissa bit is just the smallest fraction, and comparing the two parts means nothing.

Q5: A

2.75 = 10.11 = 0.1011 × 22, so the positive mantissa is 01011000 and the exponent is 0010. Inverting gives 10100111 and adding 1 gives 10101000: -1 + ¼ + 1/16 = -0.6875, and -0.6875 × 4 = -2.75. 11011000 just sets a sign bit (it is -1.25), 10100111 inverts without adding 1 (-2.78125), and 1110 negates the exponent instead of the mantissa (-0.171875).

Q6: A

0.09375 = 0.00011 = 0.11 × 2-3, so the mantissa is 01100000 and the exponent -3 is 1101. 00110000 1110 has the same value but its mantissa starts 00, so it is not normalised. 0011 is +3 (the value would be 6), and 1011 is -5 in two's complement (0.0234375).

Lab and demo

What to project

The student lesson embeds these tabs. Open them full screen on the projector; every slider has a drag handle on the stage.

Slides

Slides for this lesson

A projectable deck for every pack is on the way. Until then, present the student lesson full screen: its sections, figure and lab tabs follow the same order as the plan above.

Also for this topic

Everything else you can use

Original work by the TheLucidSTEM team. The worksheet items are written in the style of the papers; no past paper question is reproduced.
Previous lessonFile organisation, access and hashing