C Floating point arithmetic

jimc at ucla-cs.UUCP jimc at ucla-cs.UUCP
Tue Dec 10 09:14:04 AEST 1985


In article <4614 at alice.UUCP> ark at alice.UucP (Andrew Koenig) writes:

>No -- on most machines, single-precision does not offer enough significance
>for serious number-crunching, so people tend to use double-precision
>anyway if they care about the results.

Once I worked on a polynomial root package.  I found that real roots from
double real coefficients could be found with just about equal performance
as complex roots from single precision complex coefficients.  That is, the
speed of the (two different) algorithms as a function of polynomial order 
was about the same, the errors in the roots were similar, and the maximum
order before errors made the roots useless was about the same.  Obviously
:-) it's because the number of bits per coefficient was about the same in
both cases.  Here's a "valid" use of single precision.
    In another project, I cleaned up a brute-force polynomial fitter by
using suitably selected orthogonal polynomials.  I can't quite remember the
numbers, but I think the error was acceptable up to order only 4 with x**j
for a basis, but I could do 8th order using an orthogonal basis.  This was
in single precision, and 8th order was far beyond what the measurement
accuracy could justify.  Numerical performance is very sensitive to the
method, and sometimes you really need the speed and/or compactness of
single precision, so it behooves you to be serious in choosing the method.

James F. Carter            (213) 206-1306
UCLA-SEASnet; 2567 Boelter Hall; 405 Hilgard Ave.; Los Angeles, CA 90024
UUCP:...!{ihnp4,ucbvax,{hao!cepu}}!ucla-cs!jimc  ARPA:jimc at locus.UCLA.EDU



More information about the Comp.lang.c mailing list