Well, based on the name, I would have expected
(3.9438283 truncateTo: 2) to return 2.94
and
(3.9438283 truncateTo: 3) to return 2.938
along the lines of
http://en.wikipedia.org/wiki/Truncation (i.e., my previous exposure
to truncation).
However, from the definition of Number>>truncateTo:, we have:
Answer the next multiple of aNumber toward zero that is nearest the receiver.
which is interesting, but not what I would have expected at all.
(3.9438283 truncateTo: 1) to returns 3
-Chris
On Fri, Jun 3, 2011 at 2:54 PM, Nicolas Cellier
<
[hidden email]> wrote:
> This does not contradict my own expectations.
> What do you expect ?
>
> Nicolas
>
> 2011/6/3 Casimiro de Almeida Barreto <
[hidden email]>:
>> Try:
>>
>> Transcript show: (3.9438283 truncateTo: 2) asString; cr.
>>
>> It will print a nice 2 !!!
>> Change to 3. Then, a nice 3 !!!
>>
>> SqueakVM,
>> squeak trunk
>> Linux
>> always reproducible.
>>
>> Guess nobody using truncateTo for a while...
>>
>>
>
>