1.2: Roundoff Errors and Computer Arithmetic
(where f is the decimal expansion of the mantissa).
11 bits for exponents gives distinct numbers that can be
represented;
52 bits for mantissa gives distinct numbers
(that's pretty many....).
The largest number that can be represented using this normalized scheme is
about , and the smallest about
. Calculations resulting in
numbers larger than
result in overflows, which usually mean
``expect junk'' (if not an impolite crash); numbers smaller than
result in underflows, which generally cause no trouble (they're set to
zero).
Relative errors for floating-point form:
Machine numbers are the approximations we may use for all real numbers. Each is generally stored as a binary number, including information about sign, exponent, and mantissa (with a fixed number of digits dedicated to distinguishing adjacent numbers).
By replacing the infinite number of numbers within the interval of
and
by the finite number of machine numbers between those values,
we're obviously making some errors. Those errors get compounded as we perform
arithmetic operations. Two very dangerous operations are