Learning and Teaching for Mathematical Literacy

Supporting materials – 13B

Rounding errors in spreadsheets

ltml.mathlit.org

This spreadsheet shows the effect of rounding errors on repeated small additions. For those who wish to investigate coding, a Python example – showing a program which will loop endlessly because of rounding errors – is also available.

Rounding errors in spreadsheets

Image of spreadsheet illustrating rounding errors - click to download the file

Simple quadratic equation solution as python code

# Warning - this will probably loop forever!
# Change '!=' to '<=' below to see why
f = 2345
while f != 2346: f = f + 0.01 
print(f-2346) # may never get here!
                
The easiest way to experiment with the Python code is to click on Copy code above and then paste it into any online interpreter – such as this one from Python Principles.

The simple spreadsheets and python examples on this page may be copied freely.

Supporting material for the book Learning and Teaching for Mathematical Literacy by Hugh Burkhardt, Daniel Pead and Kaye Stacey (ISBN 9781032301174).

Contents of ltml.mathlit.org website – except where specified otherwise and excluding external link content - Copyright © Hugh Burkhardt, Kaye Stacey, Daniel Pead 2024, all rights reserved. These materials are offered "as is" with no warranty as to accuracy or fitness for purpose.

SIte operated by the BBDSC Trust