Re: Re: RE:Working Precision

*To*: mathgroup at smc.vnet.net*Subject*: [mg24093] Re: [mg24030] Re: [mg23928] RE:Working Precision*From*: Richard Fateman <fateman at cs.berkeley.edu>*Date*: Tue, 27 Jun 2000 00:51:51 -0400 (EDT)*Organization*: University of California, Berkeley*References*: <8iuvto$mk2@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

David Withoff wrote: > > > Here's an easily defended rule: Do all arithmetic exactly. When > > you must store the result into a finite sized memory location, > > round it to the nearest representable number exactly representable > > in that memory location. In case of a tie, round to even. > > The problem is that that rule by itself makes no allowance for > keeping track of the accumulated effects of all that rounding. That was merely the rule for finite-precision arithmetic. If you want to do blind "automatic" tracking of arithmetic, you can try to do correct interval arithmetic. This has mostly been debugged in recent Mathematica versions (but see below). Better is to take a more global view (see below.) > > > On a binary machine with a binary exponent, multiplication by 2 is > > always exact. Think about it: it adds one to the exponent, leaving > > the mantissa alone. There is no error on such a machine operation. > > Actually, the absolute error is multipled by 2. For example, > multiplying 1 +/- 1 by 2 gives (or should give) 2 +/- 2. It > shouldn't matter what sort of bit-twiddling the machine is > doing internally to arrive at this result. The mathematics > is the same regardless. > Is this meant to contradict the previous paragraph? I'm not sure it is at all related. Here are examples (written in decimal) of binary numbers that are exact. 2, 1, 0.5, 0.25, 0.125, etc. They are represented typically as though they were 1 *2^1, 1*2^0, 1*2^-1, 1*2^-2, 1*2^-3 etc. multiplying or for that matter dividing any of these by 2 provides the exact result. A sequence of multiplying by 2 n times and then dividing by 2 n times returns you to the same number. (Assuming n is not so large as to cause overflow). The absolute error is always zero. If a person is truly concerned about absolute error in a calculation, then there are ways of doing this intelligently, instead of blindly. It does matter how the computer is twiddling bits in error computations. The simplest example is this: let x = be the interval [-1, 1]. Computing x*x by [-1,1]*[-1,1] gives the interval from -1 to 1. But computing it as [-1,1]^2 gives [0,1]. Error analysis that assumes related numbers are unrelated is unlikely to be of much use. Clearly x*x and x^2 should have the same errors. Not so in Mathematica. There are really much more compelling examples, where a bit of intelligence will tell you that some function f[Interval[{low,high}] should result not in some clumsy local computation of error as is done in Mathematica, but by computing the maximum of the function f on the interval low..high. This can involve (say) computing the zeros of the derivative of f to find local max/min, as well as the endpoints. By providing two models, one for "machine arithmetic" and another for multiple-word arithmetic, Mathematica is inevitably harder to defend that a system with just one model. (My view is that the multiple-word "precision" and "accuracy" model, even if it were the only model, would still be difficult to defend...) > Dave Withoff > Wolfram Research --Richard Fateman