[squeak-dev] [BUG] some float truncateTo: x results x !!!
cunningham.cb at gmail.com
Mon Jun 6 16:45:52 UTC 2011
Well, based on the name, I would have expected
(3.9438283 truncateTo: 2) to return 2.94
(3.9438283 truncateTo: 3) to return 2.938
along the lines of
http://en.wikipedia.org/wiki/Truncation (i.e., my previous exposure
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
On Fri, Jun 3, 2011 at 2:54 PM, Nicolas Cellier
<nicolas.cellier.aka.nice at gmail.com> wrote:
> This does not contradict my own expectations.
> What do you expect ?
> 2011/6/3 Casimiro de Almeida Barreto <casimiro.barreto at gmail.com>:
>> Transcript show: (3.9438283 truncateTo: 2) asString; cr.
>> It will print a nice 2 !!!
>> Change to 3. Then, a nice 3 !!!
>> squeak trunk
>> always reproducible.
>> Guess nobody using truncateTo for a while...
More information about the Squeak-dev