2017-11-09 18:11 GMT+01:00 Raffaello Giulietti < raffaello.giulie...@lifeware.ch>:
> On 2017-11-09 15:55, Nicolas Cellier wrote: > >> >> >> 2017-11-09 15:48 GMT+01:00 Tudor Girba <tu...@tudorgirba.com <mailto: >> tu...@tudorgirba.com>>: >> >> Hi, >> >> Thanks for the answer. The example I provided was for convenience. >> >> I still do not understand why it is wrong to expect 0.1 = (1/10) to >> be true. >> >> Doru >> >> >> Because there are infinitely many different Fraction that would be >> "equal" to 0.1 then. >> The first effect is that you have >> >> a = b >> a = c >> b < c >> >> You are breaking the fact that you can sort these Numbers (are they >> Magnitude anymore?) >> You are breaking the fact that you can mix these Numbers as Dictionary >> keys (sometimes the dictionary would have 2 elements, sometimes 3, >> unpredictably). >> >> >> > Fractions are not reliable keys anyway: > (Fraction numerator: 1 denominator: 3) = (Fraction numerator: 2 > denominator: 6) > evaluates to true while > (Fraction numerator: 1 denominator: 3) hash = (Fraction numerator: 2 > denominator: 6) hash > evaluates to false > > > You are violating the invariants described in class comment in this case, and thus missusing Fraction. So it's not anymore the problem of the library