From: Lex Spoon lex@cc.gatech.edu Date: Sun, 3 Nov 2002 19:17:21 -0500
"Viktor" vi.ki@worldonline.cz wrote:
Maybe something like this (?):
[some operations] doWithPrecision: 100.
Precision is thread-variable (Thread current precisionOf Floats).
Tempting, but that doesn't handle the case that you call back into another module -- the other module will get your module's floating point precision. I guess we could posit yet a new kind of variable whith is thread-specific *and* module specific....
But in stock Squeak, how about having a variable somewhere that things in your project access whenever they start doing floating point?
x := 1.0 withPrecision: MyProject defaultFloatPrecision.
This is a nice idea.
Incidentally, I don't know that the idea of a single precision is really going to last within a single project.... Is there really just one kind of computation it performs?! Different computations will want different precisions.
Lex
Well, I'm hoping to have an upper bound on the maximum precision and just use that. It's not that I want 100 digits (say) of precision, but that I want to be more sure about the top ten digits. Of course, what I'm really saying is that I should read a textbook on numerical analysis and roundoff error ;-)
Mike