How might INEXACT be exploited?

Stuart McDonald uunet!guest.apple.com!mcdonald
Wed Feb 2 08:28:23 PST 1994


Tom McDonald writes:
>2)  How is the INEXACT flag used in an application?  I was asked recently
>    about how users might use the inexact flag in an application.  Are
>    there applications that use it?  If so, how is it used?

Exact floating-point integer arithmetic is an example.

Say you wanted to offer your customers a fraction package for integer
fraction arithmetic of the form a/b op c/d where op is +,-,*,/ and
a,b,c,d are 64-bit f.p. integers (and assume your floating-point has at least
64 bits of significance).  The package would use naive school boy algorithms
for mixed-fraction arithmetic, etc. as long as INEXACT isn't raised; if
INEXACT is raised, it recomputes the answer using a more devious algorithm
(using scaling) to preserve precision in the face of inexactness.  The intent
being to always deliver an exact answer if representable as the ratio of
two 64-bit significands.

Simply put, the INEXACT flag can be used as an indication that fast exact
algorithms have straid from exactness and its time to fall back to slower
more robust exact algorithms.



More information about the Numeric-interest mailing list