[comp.arch] Floating point accuracy

ma_jpb@bath63.UUCP (Bennett) (11/09/86)

Sender:
Reply-To: ma_jpb@ux63.bath.ac.uk (J.P. Bennett)
Followup-To: 
Distribution: 
Organization: University of Bath, England
Keywords: floating point rounding

I recall that when I was an undergraduate being taught a novel rounding
scheme for floating point, attributed I believe to David Wheeler of Cambridge
University.

The mechanism was to add a random number in the range 0 to 1 in the last digit
and then truncate. This gives better RMS error than most other rounding
schemes. It also has the advantage that numerically unstable programs are
easy to detect (they give wildly differing results on each run).

Sadly I believe this has never been implemented. Perhaps manufacturers
couldn't face tracing hardware errors in such a system...

J.P. Bennett

Computer Group
School of Mathematical Sciences
University of Bath
Claverton Down
Bath BA2 7AY
England
Tel: +44 225 826826
ma_jpb@uk.ac.bath.ux63

dave@inset.UUCP (Dave Lukes) (11/11/86)

In article <267@bath63.UUCP> ma_jpb@bath63.UUCP (Bennett) writes:
>I recall that when I was an undergraduate being taught a novel rounding
>scheme for floating point, attributed I believe to David Wheeler of Cambridge
>University.
>
>The mechanism was to add a random number in the range 0 to 1 in the last digit
>and then truncate. This gives better RMS error than most other rounding
>schemes. It also has the advantage that numerically unstable programs are
>easy to detect (they give wildly differing results on each run).

Yes, this has been mentioned before on the net.

>Sadly I believe this has never been implemented. Perhaps manufacturers
>couldn't face tracing hardware errors in such a system...

I don't buy that: most hardware these days is IEEE compatible,
with the ability to set the rounding mode:
so you debug your hardware using a deterministic rounding mode,
THEN debug the random stuff.

I think much it's much more likely that manufacturers either haven't heard
of it or don't want to implement it because it complicates things.

-- 

		Dave Lukes. (...!inset!dave)

``Fox hunting: the unspeakable chasing the inedible'' -- Oscar Wilde

ark@alice.UUCP (11/11/86)

In article <267@bath63.UUCP>, ma_jpb@bath63.UUCP (Bennett) writes:
> I recall that when I was an undergraduate being taught a novel rounding
> scheme for floating point, attributed I believe to David Wheeler of Cambridge
> University.
> 
> The mechanism was to add a random number in the range 0 to 1 in the last digit
> and then truncate. This gives better RMS error than most other rounding
> schemes. It also has the advantage that numerically unstable programs are
> easy to detect (they give wildly differing results on each run).

I suppose the biggest disadvantage of a scheme of this sort is that it
may make some programs very difficult to debug.  Suppose, for example,
that your program blows up, but only sometimes.  That could happen if
a value were randomly rounded very close to a singularity.
How would you debug such a program?

Another serious problem is that many things we take for granted would
no longer be true.  For instance, A+B would no longer always be equal
to B+A.  For that matter, A+B would not be equal to A+B.
There is also the problem of making sure this random rounding is
only applied when the result of the operation is not exact.

Finally, if you're trying to use it to detect unstable algorithms,
I would expect that something like IEEE directed rounding would be
more useful.  Run the program twice -- once rounding up and the other
time rounding down.  I would think that would tell you more about its
numerical stability than running it twice with random rounding.

henry@utzoo.UUCP (Henry Spencer) (11/11/86)

> The mechanism was to add a random number in the range 0 to 1 in the last
> digit and then truncate. This gives better RMS error than most other rounding
> schemes. It also has the advantage that numerically unstable programs are
> easy to detect (they give wildly differing results on each run).
> Sadly I believe this has never been implemented...

The IBM 7030, aka Stretch, had a random-rounding mode, although possibly
using a somewhat simpler method.  The idea was to run your program twice,
once with normal rounding and once with random rounding, and see how the
results differed.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,decvax,pyramid}!utzoo!henry