[squeak-dev] Decimals as fractions
Stéphane Rollandin
lecteur at zogotounga.net
Mon Apr 8 20:18:05 UTC 2019
> Thank you for the quick response. The slowdown is to be expected. Floats
> are immediate while Fractions are objects. I floated a strawman proposal
> to tradeoff accuracy for speed.
In my own software, and for example in my games, speed is often
paramount. I got some spectacular improvements on overall performance by
liberaly using #asFloat. I even implemented #/// as follow:
Number /// aNumber
^ self / aNumber asFloat
for cases (which I found many) where I want to ensure that a division
will never return a Fraction.
Stef
More information about the Squeak-dev
mailing list
|