
Getting Around the Errors É 291
The same equation can be written with nested multiplication
f (x) = ((x - 6)x + 3)x - 0.149.
This involves two multiplications and three additions/subtractions. The relative error
with rounding is 0.0025.
10.5 Getting Around the Errors
If not properly accounted in the programs, round-off errors can lead to major problems. For
example, the execution of “while loop” might never terminate as the conditional statement
never becomes true because of round-off errors.
Example 10.5
Consider a simple example of function err1 as follows:
function nargout = err1()
%% To illustrate the effect of round-off
errors
x = 0; ...