use decimal
David-Sarah Hopwood
david.hopwood at industrial-designers.co.uk
Thu Sep 18 20:54:54 PDT 2008
Mark S. Miller wrote:
> Long long ago I actually had read that document carefully, and I had also
> looked at I think the [Brown 1981] which it cites. (But the doc has no
> bibliography. Anyone have a pointer?) My memory of the theory of floating
> point is that the numbers are exact but the operations are approximate.
More precisely, the basic operations are "correctly rounded". That is,
they calculate the nearest representable value to the real result using a
specified rounding rule. Nothing in the basic operations of floating point
arithmetic is approximate -- they are just not the same operations as
the similarly named ones on real numbers.
(Some of the more complicated operations are specified
nondeterministically.)
You can, of course, use this exact arithmetic to *represent* values that
are only know approximately. That is where I think that the confusion
creeps into some people's mental model of floating point; they are not
distinguishing the "map" (floating point values) from the "territory"
(the application-domain values being represented).
> * A given finite floating point value exactly represents a given real
> number.
>
> * The subset of real numbers which are exactly representable in a given
> format are its "representable numbers".
>
> * The standards require various well behaved properties like:
>
> Let Tr = B2R(Xb) +r B2R(Yb) // Tr stands for True sum as a real number
> If representable(Tr) then Tr ===r B2R(Xb +b Yb)
> Else (greatest representable number <r Tr) <r B2R(Xb +b Yb) <r (smallest
> representable number >r Tr)
You mean
Else (greatest representable number <r Tr) <=r B2R(Xb +b Yb) <=r
(smallest representable number >r Tr)
--
David-Sarah Hopwood
More information about the Es-discuss
mailing list