Re: RE:Working Precision

• To: mathgroup at smc.vnet.net
• Subject: [mg24036] Re: [mg23928] RE:Working Precision
• From: Mark Sofroniou <marks at wolfram.com>
• Date: Wed, 21 Jun 2000 02:19:58 -0400 (EDT)
• Organization: Wolfram Research Inc
• References: <8ihv28\$led@smc.vnet.net> <8in7e4\$4kc@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Every floating point arithmetic system is a compromise. It is possible
to construct examples where the correlation of errors violates the
assumption of independence in Mathematica's significance arithmetic.
It is also possible to construct reasonably simple examples where
cancellation of rounding errors gives very inaccurate answers in IEEE
fixed precision floating point arithmetic, as the following example from
[1] illustrates.

Here is the analytic value of the limit of (exp(x)-1)/x.

In[1]:= Limit[(Exp[x] - 1)/x, x -> 0]

Out[1]= 1

Here are some values of the function using IEEE arithmetic.

In[2]:=
InputForm[
Table[ x = 1.  10^-i; (Exp[x] - 1)/x, {i, 10, 16}]
]

Out[2]//InputForm=
{1.000000082740371, 1.000000082740371, 1.000088900582341, 0.9992007221626409,
0.9992007221626409, 1.1102230246251563, 0.}

In contrast, Mathematica's significance arithmetic dynamically adjusts
the number of digits used in computations, based on the local conditioning
of the exponential. The subtractive cancellation no longer causes
difficulties.

This creates a software number that has the same number of mantissa
bits as an IEEE double precision floating point number.

In[3]:= one = SetPrecision[1., 53/Log[2., 10]];

In[4]:= Table[ x = one 10^-i; (Exp[x] - 1)/x, {i, 10, 16}]

Out[4]= {1.000000000050000, 1.000000000005000, 1.000000000000500,
>    1.000000000000050, 1.000000000000005, 1.000000000000001,
>    1.000000000000000}

One of Richard Fateman's criticisms of significance arithmetic seems
to be that it does not behave as one would expect a fixed precision
floating point arithmetic system. Mathematica's significance arithmetic
is designed to behave more like an interval arithmetic system, so this
is not surprising.

Both types of arithmetic system have their merits and both have
their disadvantages - otherwise there would be no more need for
numerical analysis. A drawback of fixed precision arithmetic is
that it provides no error monitoring and hence no information about
whether results are reliable.

Mark Sofroniou,
Wolfram Research.

[1] N. J. Higham, Accuracy and Stability of Numerical Algorithms.