On 11 juil. 2014, at 17:02, Natalia Tymchuk <natalia.tymchuk@unikernel.net> wrote:But why185/10 = 18.5 -> true?Because 18.5 has an exact float representation, while 0.2 hasn't.Couldn't we use #asApproximateFraction instead of #asTrueFraction in Float>>adaptToFraction:andCompare: ?0.2 asApproximateFraction ==> (1/5)0.2 asTrueFraction ==> (3602879701896397/18014398509481984)On Jul 11, 2014, at 4:40 PM, Norbert Hartl <norbert@hartl.name> wrote:Am 11.07.2014 um 16:33 schrieb Yuriy Tymchuk <yuriy.tymchuk@me.com>:On 11 Jul 2014, at 16:30, Esteban Lorenzano <estebanlm@gmail.com> wrote:On 11 Jul 2014, at 16:22, kilon alios <kilon.alios@gmail.com> wrote:why not round it before comparing it ? looks like an easy enough problem to fix . I would expect that to be equal.because it wouldn�t be correct :)But then why 4/2 = 2?The same reason why4/3 = 8/6:)NorbertOn Fri, Jul 11, 2014 at 5:18 PM, Yuriy Tymchuk <yuriy.tymchuk@me.com> wrote:
That�s why mathematics and programming are two different things�
On 11 Jul 2014, at 16:08, Esteban A. Maringolo <emaringolo@gmail.com> wrote:
> Usually comparing against floats is not as deterministic as you would
> expect. And in other dialects you use #equals: instead of #=
>
> But in Pharo there is no #equals: and instead there is a #closeTo:,
> but #closeTo: has an arbitrary decimal precision, more than enough for
> commong arithmetic.
>
> Regards!
>
> Esteban A. Maringolo
>
>
> 2014-07-11 10:59 GMT-03:00 Goubier Thierry <thierry.goubier@cea.fr>:
>> :)
>>
>> in Smalltalk, the division of two integers is a fraction, not a float.
>>
>> i.e. 1/5 is 1/5.
>>
>> Thierry
>>
>> Le 11/07/2014 15:53, Natalia Tymchuk a �crit :
>>>
>>> Hello.
>>> I found interesting thing:
>>> Why it is like this?
>>>
>>> Best regards,
>>> Natalia
>>>
>>
>> --
>> Thierry Goubier
>> CEA list
>> Laboratoire des Fondations des Syst�mes Temps R�el Embarqu�s
>> 91191 Gif sur Yvette Cedex
>> France
>> Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95
>>
>