arbitrary precision floats?
Daniel Joyce
daniel.a.joyce at worldnet.att.net
Sun Nov 3 15:46:21 UTC 2002
On Sunday 03 November 2002 01:41 am, Michael Vanier wrote:
> I agree with your criticisms. However, what I want is to be able to
> set the float precision on a project-wide basis. In other words, I
> want to be able to say "all BigFloats now have 10 decimal places" and
> do some computations. If I suspect that the results are incorrect
> due to compounding of numerical errors, I want to be able to change
> this to 100 decimal places in one place only and recompute my
> results. It may not be thread safe or modular, but it's what I want
> to be able to do. Having to adjust float precision in a zillion
> different places is simply unmaintainable.
>
> Mike
There are rules for when one gains and loses precision by multiplying
/Div / Add / sub floating pt numbers together. Any good comp sci book
on arbitrary prec floating point techniques contains them.
Why not just make and use a implementation that follows these rules?
That way, you never have too much or too little precision... ;)
You can also set it yourself, or subclass from the arb fp class and get
that universal precision you want...
-Daniel
More information about the Squeak-dev
mailing list
|