Floating Point Arithmetic
Richard Harter
rh at smds.UUCP
Sat Nov 10 18:59:36 AEST 1990
In article <14406 at smoke.brl.mil>, gwyn at smoke.brl.mil (Doug Gwyn) writes:
> In article <RANG.90Nov8132409 at nexus.cs.wisc.edu> rang at cs.wisc.edu (Anton Rang) writes:
> > Of course, it's just as easy to write code which will give you
> >double-precision garbage as it is to get single-precision garbage.
> I disagree. Except for special, heavily iterative algorithms that would
> probably not be attempted by the naive, generally double-precision
> arithmetic produces usable answers more often than single-precision would.
One can scarcely argue with this -- it is in the nature of things that
double precision will be more accurate than single precision! However
it is somewhat misleading. In the majority of situations answers and
data with 3-4 places of precision are all that are required or are meaningful.
The loss of precision is typically 3 places or less; 32 bit single precision
(float on most machines today) is sufficient. Situations where 32 bit
precision does not suffice are usually either numerically poorly conditioned
or inherently require high precision. In these cases double precision
is a dangerous nostrum -- one should do one's numerical analysis homework.
--
Richard Harter, Software Maintenance and Development Systems, Inc.
Net address: jjmhome!smds!rh Phone: 508-369-7398
US Mail: SMDS Inc., PO Box 555, Concord MA 01742
This sentence no verb. This sentence short. This signature done.
More information about the Comp.lang.c
mailing list