Hernan, floating point values are fractions of the form

+/- m * 2^k

for positive integers m of up to a certain number of bits.  Your example 
requires

13/10 = m * 2^k

which is not possible.  In slow motion...

2^k = 13/10m

To get rid of 13, m must be 13*n...

2^k = 1/10n

Now, 1/10 = 1/5 * 1/2, so...

2^{k+1} = 1/5n

and then we reach

n 2^{k+1} = 1/5

which is absurd for integer n, k.

Andres.


Hernan Wilkinson wrote:
> 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]].
>
>    ...)
>
>
> Hernan.
>
>
>   

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to