GCSE · Computer Science · Eduqas · Spec C500QS

Truncation errors

Press run. No red text, no crash, no warning. And the answer is wrong. How can a program be wrong and say nothing?

Computer Science · Truncation errors

Be the computer: chop, then keep going

Each pass adds 0.19 to total, then truncate(…, 1) keeps one decimal place and cuts the rest off.

You are the computer. Call each marked step before the table shows it. Nothing is really run: every value is the lesson's. truncate(x, 1) is a made-up function for this lesson that keeps 1 decimal place and cuts the rest off. The program has no exact or lost; we added those two columns to show what a perfect calculator would hold and how much has gone missing.

total = 0
for i = 1 to 4
total = truncate(total + 0.19, 1)
next i
print(total)
itotalexactlost
000

Step 1. total starts at 0. This first row is worked for you.

Step 1 of 6Called right: 0 of 5

Cut the extra digits off. Do not round.

Why it happens

?

Reason it through

Why does a computer end up chopping the end off a number?

Link 1 of 4

First link · your turn

A computer has to keep every number somewhere. How much room does each number get?

2
Locked — reveal the link above first
3
Locked — reveal the link above first
4
Locked — reveal the link above first

Computer Science · Truncation errors

Finish the working

A program truncates 3.789 to two decimal places. Another truncates the real number 7.9 to an integer. Find the truncation error in each.

  1. 3.789 to two decimal places: keep the digits up to the 8 and cut off the 9.Two decimal places means two digits after the point.
  2. missing step
Which line is step 2?

Exam line: Cut the digits off without rounding, then work out the error as true value minus truncated value.

Computer Science · Truncation errors

What do you think is going on?

A program stores 3.789 using two decimal places, and it truncates the number to do it.

Which is closest to what you think happens?
How sure are you?

Exam line: Say it plainly: truncation cuts digits off without rounding, moves a value towards zero, and the program still runs with an inaccurate result.

Computer Science · Truncation errors

Write it, then mark it

A program stores the number 5.678 as 5.67 by cutting off the last digit. Explain what a truncation error is and why one can occur in a program. Use this number to show the size of the error. [4 marks]

0 words · your answer stays on this page and is not sent anywhere.

Exam line: Definition, cause, then a worked figure: say what it is, why it happens, and show the error as true value minus truncated value.

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

What happens when a computer chops digits off a number, and why the program carries on anyway

What you need to know

  • A computer stores each number in a fixed number of bits or digits, so there is only so much room.
  • A value that needs more digits than that, like 1/3 = 0.3333..., has its extra digits cut off.
  • Truncating means keeping the digits up to a chosen place and discarding every digit after it, whatever its value.
  • The kept digits are not changed. So 3.789 truncated to two decimal places is 3.78, not 3.79.
  • Have a goYour turn: a program truncates 6.451 to one decimal place. What does it store?

    6.4

    Keep the digits up to the first decimal place and cut the rest. Rounding would have given 6.5, but truncation never rounds.

  • Converting a real number to an integer by truncation discards the fractional part, so 7.9 becomes 7.
  • A truncation error is an inaccuracy in a number caused by digits being cut off without rounding.
  • Its size is the true value minus the truncated value: 3.789 − 3.78 = 0.009.
  • Have a goA program truncates 2.846 to one decimal place and stores 2.8. How big is the truncation error?

    0.046

    True value minus truncated value: 2.846 − 2.8 = 0.046. Subtract the stored value from the true one, not the other way round.

  • Truncation always moves a value towards zero, so a truncated positive number is never larger than the true value.
  • Have a goDev swears his program truncated 2.7 to 3 and 'saved a bit of space'. Dev is confidently wrong. What went wrong?

    Truncating 2.7 gives 2, not 3.

    Truncation moves a positive number towards zero, so it is never larger than the true value. 3 is bigger than 2.7, so that was rounding.

  • A program with a truncation error still runs, but its results are inaccurate.
  • Reuse truncated values in later calculations and the errors can build up into a noticeably inaccurate result.

The big picture

Truncation cuts a number's extra digits off without rounding, so the stored value is a little off the true one. The gap, true value minus truncated value, is the truncation error. It happens because a computer stores numbers in a fixed number of bits or digits. The program still runs, but if truncated values are reused the errors can build up into a noticeably inaccurate result.

Key points

1Truncation cuts digits off after a chosen place and never rounds; the kept digits do not change.
2Truncation error = true value − truncated value, for example 3.789 − 3.78 = 0.009.
3Truncation moves a value towards zero, so a truncated positive number is never larger than the true value.
4Truncation errors happen because a computer stores a number in a fixed number of bits or digits.
5The program still runs, but reusing truncated values lets the errors build up into a noticeably inaccurate result.

Worked example

Problem

A program truncates 12.3456 to three decimal places. What value does it store, and what is the truncation error?

⚠ Watch out

Rounding instead of truncating. Truncating 2.678 to two decimal places gives 2.67, not 2.68: the 8 is just cut off, and it cannot push the 7 up.

🧠

Memory hook

Truncate is a guillotine, not a rounder: it chops the tail off and never nudges what is left.

✓

Check yourself

Without looking back: truncate 8.762 to one decimal place and work out the truncation error. Then say whether the program that did this would crash, and why not.

Flashcards

(10)
What is a truncation error?
An inaccuracy in a numeric value caused by digits being cut off (discarded) without rounding.
What does truncating a number to a chosen number of places do?
It keeps the digits up to that place and discards every digit after it, whatever its value. The kept digits are not changed.
Truncating or rounding: which one can change the last kept digit?
Rounding can. Truncation never does: it only cuts digits off.
Truncation error: do you subtract true from truncated, or truncated from true?
True value minus truncated value, so the answer is not negative for a positive number.
Which way does truncation move a value?
Towards zero, so a truncated positive number is never larger than the true value.
Why do truncation errors happen?
A computer stores a number in a fixed number of bits or digits, so a value that needs more has its extra digits cut off.
Why can a fixed number of digits not store 1/3 exactly?
1/3 = 0.3333... needs more digits than are available, so the extra digits are cut off.
What happens when a real number is converted to an integer by truncation?
The fractional part is discarded and the integer part is kept unchanged.
Does a truncation error make a program crash?
No. The program still runs, but its results are inaccurate.
What can happen when truncated values are used again in further calculations?
The errors can build up and make the final result noticeably inaccurate.

Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.

Learning with Lightbulb is opening soon

You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.

Keep me posted

More Eduqas GCSE Computer Science topics

See the full Eduqas Computer Science curriculum →

How this lesson was checked. This Eduqas GCSE Computer Science (specification C500QS)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 16 November 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.