Iecm
Iecm
Concept of Error
Concept of Error
The error that is produced when a calculator or computer is used to perform realnumber
calculations is called round-off error. It occurs because the arithmetic performed in a
machine involves numbers with only a finite number of digits, with the result that
calculations are performed with only approximate representations of the actual numbers. In
a computer, only a relatively small subset of the real number system is used for the
representation of all the real numbers. This subset contains only rational numbers, both
positive and negative, and stores the fractional part, together with an exponential part.
Concept of Error
• Error due to rounding should be expected whenever computations are performed using numbers
that are not powers of 2. Keeping this error under control is extremely important when the number
of calculations is large.
• IEEE standard: A 64-bit (binary digit) representation is used for a real number. The first bit is a sign
indicator, denoted s. This is followed by an 11-bit exponent, c, called the characteristic, and a 52-
bit binary fraction, f , called the mantissa. The base for the exponent is 2.
Concept of Error
• Overflow: Numbers greater than result in overflow and typically cause the computations to stop (unless the
program has been designed to detect this occurrence).
• Note that there are two representations for the number zero; a positive 0 when s = 0, c = 0 and f = 0, and a
negative 0 when s = 1, c = 0 and f = 0. For 64-bit integers:
Concept of Error
• Interesting reads:
• https://www.mathworks.com/help/matlab/matlab_prog/floating-point-numbers.html
Concept of Error
2. Rounding: The sixth digit of the decimal expansion of π is a 9, so the floating-point form of π
using five-digit rounding is fl(π) = (0.31415 + 0.00001) × 101 = 3.1416
Concept of Error
Suppose that p∗ is an approximation to p. The absolute error is |p − p∗|, and the relative error is |
p − p∗| / |p|, provided that p ≠ 0.
Question: Determine the absolute and relative errors when approximating p by p ∗ when
Concept of Error
Example:
Polynomials should always be expressed in nested form before performing an evaluation, because
this form minimizes the number of arithmetic calculations.
Concept of Error
Concept of Error
Concept of Error
Concept of Error
Intermediate Conversions
Concept of Error
Linear Algebra: Common issues in floating-point arithmetic, such as the ones described above, can
compound when applied to linear algebra problems because the related calculations typically consist
of multiple steps. For example, when solving the system of linear equations Ax = b, MATLAB warns
that the results may be inaccurate because operand matrix A is ill conditioned.
Concept of Error
• Other techniques