On 19/10/11 4:19 PM, Fred Cisin wrote:
On Wed, 19 Oct 2011, David Cantrell wrote:
I would like to be able to:
* mark a variable as being an approximation, and with how precise it is;
THAT is already present. "float" in C means that it is an approximation
to 24 binary significant digits.
It does NOT, admittedly, however, tell you that any numbers that it was
based on were also only approximate.
Or rather, *how much* of the value is significant.
* for those markers to propagate to any result
that arises from a
calculation involving that variable;
THAT would be NICE!
I'm curious how you would implement it. I guess that you could create a
"floatpt struct" that contains a float and an int count of how many floats
were used to create the value. That count could "approximate" how many of
the least significant bits are meaningless.
That "count" wouldn't mean much. But you can track, at least through
simple operations, how much of the value is significant. Compared to the
agonies of C, this would be a straightforward addition to any Lisp
numeric tower.
The idea has been around for a while - usually named "significance
arithmetic". In particular, Mathematica implements a related system (fwiw).
*
http://mathworld.wolfram.com/SignificanceArithmetic.html
*
http://www.wolfram.com/technology/guide/SignificanceArithmetic/
*
http://www.mathkb.com/Uwe/Forum.aspx/mathematica/21243/remarks-on-significa…
* and some of the Usenet links I posted earlier. Steve Richfield has
advocated this proposal as an important refinement of IEEE-754.
--T
--
Grumpy Ol' Fred cisin at
xenosoft.com