§3.1 Arithmetics and Error Measures
Contents
- §3.1(i) Floating-Point Arithmetic
- §3.1(ii) Interval Arithmetic
- §3.1(iii) Rational Arithmetics
- §3.1(iv) Level-Index Arithmetic
- §3.1(v) Error Measures
§3.1(i) Floating-Point Arithmetic
Computer arithmetic is described for the binary based system with base 2; another frequently used system is the hexadecimal system with base 16.
A nonzero normalized binary floating-point machine number is
represented as
![x=(-1)^{s}\cdot(b_{0}.b_{1}b_{2}\dots b_{{p-1}})\cdot 2^{E},](https://webarchive.library.unt.edu/web/20130217234540im_/http://dlmf.nist.gov/3/1/E1.png)
![b_{0}=1](https://webarchive.library.unt.edu/web/20130217234540im_/http://dlmf.nist.gov/3/1/m57.png)
where is equal to 1 or 0, each
,
, is either 0 or 1,
is the most significant bit,
(
) is the number of
significant bits
,
is the least significant bit,
is
an integer called the exponent,
is the
significand, and
is the fractional
part.
The set of machine numbers is the union of 0 and
the set
![(-1)^{s}2^{E}\sum _{{j=0}}^{{p-1}}b_{j}2^{{-j}},](https://webarchive.library.unt.edu/web/20130217234540im_/http://dlmf.nist.gov/3/1/E2.png)
with and all allowable choices of
,
,
, and
.
Let with
and
. For given values of
,
, and
, the format width in bits
of a computer word is the total number
of bits:
the sign (one bit), the significant bits
(
bits), and the bits allocated to the exponent (the remaining
bits). The
integers
,
, and
are characteristics of the
machine. The machine epsilon
, that is, the distance
between 1 and the next larger machine number with
is given by
. The machine precision is
. The lower and upper bounds for the absolute
values of the nonzero machine numbers are given by
![N_{{{\rm min}}}\equiv 2^{{E_{{{\rm min}}}}}\leq|x|\leq 2^{{E_{{{\rm max}}}+1}}\left(1-2^{{-p}}\right)\equiv N_{{{\rm max}}}.](https://webarchive.library.unt.edu/web/20130217234540im_/http://dlmf.nist.gov/3/1/E3.png)
Underflow (overflow) after computing occurs when
is
smaller (larger) than
(
).
¶ IEEE Standard
¶ Rounding
Let be any positive number with
![x=(1.b_{1}b_{2}\dots b_{{p-1}}b_{p}b_{{p+1}}\dots)\cdot 2^{E},](https://webarchive.library.unt.edu/web/20130217234540im_/http://dlmf.nist.gov/3/1/E4.png)
, and
![x_{{-}}=(1.b_{1}b_{2}\dots b_{{p-1}})\cdot 2^{E},](https://webarchive.library.unt.edu/web/20130217234540im_/http://dlmf.nist.gov/3/1/E5a.png)
![x_{{+}}=((1.b_{1}b_{2}\dots b_{{p-1}})+\epsilon _{M})\cdot 2^{E}.](https://webarchive.library.unt.edu/web/20130217234540im_/http://dlmf.nist.gov/3/1/E5b.png)
Then rounding by chopping or rounding down of gives
,
with maximum relative error
. Symmetric rounding or
rounding to nearest of
gives
or
, whichever is nearer
to
, with maximum relative error equal to the machine precision
.
Negative numbers are rounded in the same way as
.
§3.1(ii) Interval Arithmetic
Interval arithmetic is intended for bounding the total effect of rounding errors of calculations with machine numbers. With this arithmetic the computed result can be proved to lie in a certain interval, which leads to validated computing with guaranteed and rigorous inclusion regions for the results.
Let be the set of closed intervals
. The elementary arithmetical
operations on intervals are defined as follows:
![I*J=\{ x*y\,|\, x\in I,y\in J\},](https://webarchive.library.unt.edu/web/20130217234540im_/http://dlmf.nist.gov/3/1/E6.png)
![I,J\in G](https://webarchive.library.unt.edu/web/20130217234540im_/http://dlmf.nist.gov/3/1/m28.png)
where , with appropriate roundings of the end points of
when machine numbers are being used. Division is possible only if the
divisor interval does not contain zero.
§3.1(iii) Rational Arithmetics
Computer algebra systems use exact rational arithmetic with rational
numbers , where
and
are multi-length integers. During the
calculations common divisors are removed from the rational numbers, and the
final results can be converted to decimal representations of arbitrary length.
For further information see Matula and Kornerup (1980).
§3.1(iv) Level-Index Arithmetic
To eliminate overflow or underflow in finite-precision arithmetic numbers are
represented by using generalized logarithms given by
![\mathop{\ln\/}\nolimits _{{0}}(x)=x,](https://webarchive.library.unt.edu/web/20130217234540im_/http://dlmf.nist.gov/3/1/E7a.png)
![\mathop{\ln\/}\nolimits _{{\ell}}(x)=\mathop{\ln\/}\nolimits\!\left(\mathop{\ln\/}\nolimits _{{\ell-1}}(x)\right),](https://webarchive.library.unt.edu/web/20130217234540im_/http://dlmf.nist.gov/3/1/E7b.png)
![\ell=1,2,\dots](https://webarchive.library.unt.edu/web/20130217234540im_/http://dlmf.nist.gov/3/1/m39.png)
with and
the unique nonnegative integer such that
. In level-index arithmetic
is
represented by
(or
for negative numbers).
Also in this arithmetic generalized precision can be defined, which includes
absolute error and relative precision (§3.1(v)) as special cases.
§3.1(v) Error Measures
If is an approximation to a real or complex number
, then the
absolute error is
![\epsilon _{a}=\left|x^{{*}}-x\right|.](https://webarchive.library.unt.edu/web/20130217234540im_/http://dlmf.nist.gov/3/1/E8.png)
If , the relative error is
![\epsilon _{r}=\left|\frac{x^{{*}}-x}{x}\right|=\frac{\epsilon _{a}}{\left|x\right|}.](https://webarchive.library.unt.edu/web/20130217234540im_/http://dlmf.nist.gov/3/1/E9.png)
The relative precision is
![\epsilon _{{\mathit{rp}}}=\left|\mathop{\ln\/}\nolimits\!\left(\ifrac{x^{{*}}}{x}\right)\right|,](https://webarchive.library.unt.edu/web/20130217234540im_/http://dlmf.nist.gov/3/1/E10.png)
where for real variables, and
for complex
variables (with the principal value of the logarithm).
The mollified error is
![\epsilon _{m}=\frac{\left|x^{{*}}-x\right|}{\max(\left|x\right|,1)}.](https://webarchive.library.unt.edu/web/20130217234540im_/http://dlmf.nist.gov/3/1/E11.png)
For error measures for complex arithmetic see Olver (1983).