2009/7/8 Michael van der Gulik <mikevdg@gmail.com>:
2009/7/8 Hernan Wilkinson <hernan.wilkinson@gmail.com>
I added this new issue that happens on the latest image. I'm posting it here because I think it is an important bug because it affects the number model. The problem is related with all fractions who's denominator is not power of two. (130/100 = 1.3 or 1/5 = 0.2, etc) (See
Float>>adaptToFraction: rcvr andCompare: selector where it does .... "Try to avoid asTrueFraction because it can cost" selector == #= ifTrue: [ rcvr denominator isPowerOfTwo ifFalse: [^false]].
...)
A hypothetical question: would it be harmful if the compiler stored number literals as Fractions rather than Floats? For example, the compiler could store "1.3" as the literal "13/10" in the CompiledMethod. The denominator would always be a multiple of 10 or whatever the base of the specified number is.
Gulik.
Well this already exists and is named ScaledDecimal...
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project