[Newbies] Re: is 0.1 a Float or a ScaledDecimal ?

cdrick cdrick65 at gmail.com
Wed Feb 20 17:27:09 UTC 2008

> I don't know what you are working on but if you use fractions for what you are
> doing it would be interesting to hear about how you use them and your results.
> Because fractions are kept as an integer numerator and an integer denominator,
> they probably take up more memory than floats but less than ScaledDecimals.  And
> because both the numerator and denominator can be large integers, fractions can
> be very precise.  But because they are implemented in both software and
> hardware, then can be slow.  However, many numerical functions seem to have
> fractions or divisions built into them.  If fractions are used and the divisions
> not preformed until they absolutely have to be, then use of fractions could be
> faster than expected and may be faster than ScaledDecimals or floats.  I have no
> proof of this but if you do anything in this area, I would love to hear about
> it.

I think all this is premature optimization for me :) as I'm only
building an early prototype (I'm doing a start of Dempster Shafer
Theory [1] implementation (actually Transferable Belief Model)... and
it's won't reach a big size for a while. It allows to have an
imprecise, incomplete even uncertain value for a proposition (sort of
multi-valued attribute with confidence...). I use it to get expert
opinion on values, it's a known technique for different captor data
fusion, but in my case, it doesn't demand too much performance as the
combination is not that important (compared to sensor data fusion) ;)

Talking about that, that make me remember I needed a method subsets
(for Set) and didn't found one. So I implementented one which will be
cool to discuss here maybe (instead of something iterative, I've
hacked something with binary masks, so it's 2 methods - 2 methods that
took me two days but that's the fun of Smalltalk ! :)


[1] http://en.wikipedia.org/wiki/Dempster-Shafer_theory

More information about the Beginners mailing list