On 19/10/11 6:34 AM, David Cantrell wrote:
On Tue, Jan 18, 2011 at 09:42:08PM +0000, Tony Duell
wrote:
> I wish there was a widely available, widely
known general purpose
> programming language which had a "number with precision" type, which
> would Do The Right Thing when doing things like multiplying values
> together - ie, decreasing the precision ...
I would like to be able to:
* mark a variable as being an approximation, and with how precise it is;
* for those markers to propagate to any result that arises from a
calculation involving that variable;
It is not clear why this idea has been so consistently ignored, except
it may be another case of "worse is better"...
Re Steve Richfield's "significance arithmetic" proposal, see:
https://groups.google.com/d/msg/comp.arch.arithmetic/d9YzeOe3Bok/eQT9uNBUCO…
https://groups.google.com/d/msg/comp.arch.arithmetic/d9YzeOe3Bok/wlDjDjshfK…
https://groups.google.com/d/msg/comp.arch.arithmetic/aCDUAQDgmOg/vqgbA2YUpn…
More rationale:
https://groups.google.com/d/msg/comp.arch.arithmetic/aCDUAQDgmOg/dnRUg3kuvr…
et seq.
There are many good anecdotes in that thread - including at least one
involving Dennis Ritchie - and much discussion of the shortcomings of
IEEE-754 arithmetic.
Richfield: "Significance arithmetic will not change ANY results - it
will just tell you which ones are reaching beyond the capability of the
methodology being used."
Mathematica does some precision tracking, for what it's worth.
--Toby
those two are somewhat similar to "tainting" of variables in perl; I
presume that similar features exist in other dynamic languages and maybe
in some others.
* for those propagated markers to have the appropriate precision
attached. NB this is *not* just a copy of the original precision -
while 1.414 is sqrt(2) to 4sf, 65220 is a lot less precise!
* to specify required precisions for the variables I store my results
in, or for functions' return values, or for functions' parameters, and
to throw exceptions if those are violated