2 Rounding
In general, a computer is unable to store every decimal place of a real number. Real numbers are rounded . To round a number to significant figures we look at the digit in the decimal expansion of the number.
- If the digit is 0, 1, 2, 3 or 4 then we round down : that is, we simply chop to places. (In other words we neglect the digit and any digits to its right.)
- If the digit is 5, 6, 7, 8 or 9 then we round up : we add to the decimal place and then chop to places.
For example
An alternative way of stating the above is as follows
Sometimes the phrases “significant figures" and “decimal places" are abbreviated as “s.f." or
“sig. fig." and “d.p." respectively.
Example 1
Write down each of these numbers rounding them to 4 decimal places:
,
,
,
,
Solution
, , , ,
Example 2
Write down each of these numbers, rounding them to 4 significant figures:
,
,
,
,
Solution
, , , ,
Task!
Write down each of these numbers, rounding them to 3 decimal places:
,
,
,
, , ,
2.1 Rounding error
Clearly, rounding a number introduces an error. Suppose we know that some quantity is such that
Based on what we know about the rounding process we can deduce that
This is typical of what can occur when dealing with numerical methods. We do not know what value takes, but we have an error bound describing the furthest can be from the stated value . Error bounds are necessarily pessimistic. It is very likely that is closer to than , but we cannot assume this, we have to assume the worst case if we are to be certain that the error bound is safe.
Key Point 2
Rounding a number to decimal places introduces an error that is no larger (in magnitude) than
Note that successive rounding can increase the associated rounding error, for example
2.2 Accumulated rounding error
Rounding error can sometimes grow as calculations progress. Consider these examples.
Example 3
Let and . It follows that, to 9 decimal places
- Round and to 7 significant figures. Find and .
- Round and to 3 significant figures. Find and .
Solution
-
To 7 significant figures
and
and it follows that, with this rounding of the numbers
The outputs ( and ) are as accurate to as many decimal places as the inputs ( and ). Notice however that the difference is now only accurate to 4 significant figures.
-
To 3 significant figures
and
and it follows that, with this rounding of the numbers
This time we have no significant figures accurate in .
In Example 3 there was loss of accuracy in calculating . This shows how rounding error can grow with even simple arithmetic operations. We need to be careful when developing numerical methods that rounding error does not grow. What follows is another case when there can be a loss of accurate significant figures.
Task!
This Task involves solving the quadratic equation
- Use the quadratic formula to show that the two solutions of are .
- Write down the two solutions to as many decimal places as your calculator will allow.
- Now round to 4 significant figures and recalculate the two solutions.
- How many accurate significant figures are there in the solutions you obtained with the rounded approximation to ?
- From the quadratic formula as required.
- is one solution and is the other, to 10 significant figures.
-
Rounding
to 4 significant figures gives
- The first of these is only accurate to 1 sig. fig., the second is accurate to 4 sig. fig.
Task!
In the previous Task it was found that rounding to 4 sig. fig. led to a result with a large error for the smaller root of the quadratic equation. Use the fact that for the general quadratic
the product of the two roots is to determine the smaller root with improved accuracy.
Here so the product of the roots . So starting from the rounded value for the larger root we obtain the smaller root to be with 4 sig. fig. accuracy.
(This indirect method is often built into computer software to increase accuracy.)