[squeak-dev] Re: Is there a better implementation of Floats?

nice ncellier at ifrance.com
Thu Apr 10 19:57:28 UTC 2008


Paolo Bonzini wrote:
> Bernd Elkemann wrote:
>>> If you really want Floating point operations (that is inexact) with 
>>> more digits, I initiated the ArbitraryPrecisionFloat package at 
>>> http://www.squeaksource.com/ArbitraryPrecisionFl/ . You can download 
>>> it using Monticello or SqueakMap (better use Monticello, the 
>>> SqueakMap will point on an old version).
>>
>> I think thats exactly what i need,
>> thanks so much
> 
> Actually I'm sure it is not.  It will have exactly the same problems, 
> they are less likely but cannot be magically solved: 0.1, 0.15, 0.2, 0.3 
> are anyway periodic numbers in base-2.
> 
> Paolo
> 
> 

Absolutely right.

Computing with excess precision and rounding result afterward is not 
guaranteed to work, compared to strict IEEE754, it only lowers 
probability of rounding error.

((0.35s2 asArbitraryPrecisionFloatNumBits: 69) - (0.1s2 
asArbitraryPrecisionFloatNumBits: 69)) asFloat = 0.25 -> true.

Some kind of emulation of what an extended precision Intel floating 
point register would do... Much slower, but totally portable and under 
the control of  programmer.

Of course, testing for strict equality after some inexact operations is 
certainly not a recommended practice, so the question was biased.
We cannot infer further underlying intention of Bernd. Up to his 
responsibility.

Nicolas




More information about the Squeak-dev mailing list