Approximations and Round-Off Errors
Approximations and Round-Off Errors
Chapter 3
1
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• Numerical methods yield approximate results that are close to the exact analytical
solution.
• How confident we are in our approximate result ? In other words,
“how much error is present in our calculation and is it tolerable?”
Significant Figures
• Number of significant figures indicates precision. Significant digits of a number
are those that can be used with confidence, e.g., the number of certain digits plus
one estimated digit.
5.38 x 104 3
5.3800 x 104 5
Zeros are sometimes used to locate the decimal point not significant figures.
0.00001753 4
0.001753 4
2
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Identifying Significant Digits
http://en.wikipedia.org/wiki/Significant_figures
•All non-zero digits are considered significant. For example, 91 has two significant
figures, while 123.45 has five significant figures
•Leading zeros are not significant. Ex: 0.00052 has two significant figures.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Error Definitions
Approximate Error
• For numerical methods, the true value will be known only when we deal
with functions that can be solved analytically.
• In real world applications, we usually do not know the answer a priori.
Approximate error
Approximate Relative Error : a 100%
Approximation
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Iterative approaches
If εs is chosen as:
s (0.5 10(2-n) )%
Then the result is correct to at least n significant figures (Scarborough 1966)
5
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
EXAMPLE 3.2: Maclaurin series expansion
2 3 n
x x x
e x 1 x ...
2 3! n!
Calculate e0.5 (= 1.648721…) up to 3 significant figures. During the calculation
process, compute the true and approximate percent relative errors at each step
= 3.1415926535….
• Discrepancy introduced by this omission of significant figures is called round-
off or chopping errors.
86409
in Base-10
173
in Base-2
8
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The representation of -173 on a 16-bit computer
using the signed magnitude method
9
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Computer representation of a floating-point number
exponent
m.be
mantissa
Base of the number system used
10
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
156.78 0.15678x103
(in a floating point base-10
system)
1
0.029411765
34 Suppose only 4
decimal places
0 to be stored
0.029410
11
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• Due to Normalization, absolute value of m is limited: 1
m 1
b
for base-10 system: 0.1 ≤ m < 1
for base-2 system: 0.5 ≤ m < 1
Another Exercise: What is the largest positive floating point number that can be
represented using a 7-bit word (3-bits reserved for mantissa).
12
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.