Page 42 - Applied Numerical Methods Using MATLAB
P. 42
COMPUTER ERRORS VERSUS HUMAN MISTAKES 31
In the process of adding the two numbers, an alignment is made so that the
two exponents in their 64-bit representations equal each other; and it will kick
out the part smaller by more than 52 bits, causing some numerical error. For
example, adding 2 −23 to 2 30 does not make any difference, while adding 2 −22 to
2 30 does, as we can see by typing the following statements into the MATLAB
Command window.
>>x = 2^30; x + 2^-22 == x, x + 2^-23 == x
ans = 0(false) ans = 1(true)
(cf) Each range has a different minimum unit (LSB value) described by Eq. (1.2.5). It
implies that the numbers are uniformly distributed within each range. The closer the
range is to 0, the denser the numbers in the range are. Such a number representation
makes the absolute quantization error large/small for large/small numbers, decreasing
the possibility of large relative quantization error.
1.2.2 Various Kinds of Computing Errors
There are various kinds of errors that we encounter when using a computer for
computation.
ž Truncation Error: Caused by adding up to a finite number of terms, while
we should add infinitely many terms to get the exact answer in theory.
ž Round-off Error: Caused by representing/storing numeric data in finite bits.
ž Overflow/Underflow: Caused by too large or too small numbers to be rep-
resented/stored properly in finite bits—more specifically, the numbers hav-
ing absolute values larger/smaller than the maximum (f max )/minimum(f min )
number that can be represented in MATLAB.
ž Negligible Addition: Caused by adding two numbers of magnitudes differing
by over 52 bits, as can be seen in the last section.
ž Loss of Significance: Caused by a “bad subtraction,” which means a sub-
traction of a number from another one that is almost equal in value.
ž Error Magnification: Caused and magnified/propagated by multiplying/divi-
ding a number containing a small error by a large/small number.
ž Errors depending on the numerical algorithms, step size, and so on.
Although we cannot be free from these kinds of inevitable errors in some degree,
it is not computers, but instead human beings, who must be responsible for
the computing errors. While our computer may insist on its innocence for an
unintended lie, we programmers and users cannot escape from the responsibility
of taking measures against the errors and would have to pay for being careless
enough to be deceived by a machine. We should, therefore, try to decrease the
magnitudes of errors and to minimize their impact on the final results. In order
to do so, we must know the sources of computing errors and also grasp the
computational properties of numerical algorithms.