C Floating point arithmetic

Ken Turkowski ken at turtlevax.UUCP
Mon Dec 2 15:10:41 AEST 1985


In article <608 at ttrdc.UUCP>, levy at ttrdc.UUCP (Daniel R. Levy) writes:
> ... I surmise there might be testable conditions whereby it
> could be determined (without an overly large computational penalty) whether
> a computation could be entrusted to single precision or whether double
> precision should be used, prior to actually performing the computation.

You are indeed correct.  The field of numerical analysis is a
discipline that is concerned with determining the error in a
calculation given the arithmetic precision of a machine.  I have done a
fair amount of coding in both floating-point and fixed-point arithmetic
which carries around as much precision as needed to guarantee
correctness of the results.

Granted, error analysis can sometimes be painful.  One easy way to
determine how much precision to carry around is to first do the
computations in very high precision, and then decrease the precision
until the errors are intolerable.
-- 
Ken Turkowski @ CIMLINC (formerly CADLINC), Menlo Park, CA
UUCP: {amd,decwrl,hplabs,seismo,spar}!turtlevax!ken
ARPA: turtlevax!ken at DECWRL.DEC.COM



More information about the Comp.lang.c mailing list