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

Louis LaBrunda Lou at Keystone-Software.com
Wed Feb 20 16:58:52 UTC 2008


Hi Cédrick,

I'm Glad to be of some help.

>[snip]
>Also, I didn't know 0.1234s4 notation before so having a unit test
>failing was finally a good thing. I was testing a method called
>remainingWeight (so basically 1 - SumOfAllSubsetWeight, hence the test
>of *egality*... between floats)).
>
>Cédrick

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.

Lou
-----------------------------------------------------------
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:Lou at Keystone-Software.com http://www.Keystone-Software.com



More information about the Beginners mailing list