Is this a buglet? (SmallInteger>>printString related)

Bert Freudenberg bert at freudenbergs.de
Wed May 30 11:37:50 UTC 2007


On May 30, 2007, at 13:01 , Göran Krampe wrote:

> Hi!
>
> In playing around with SmallInteger>>printString (see
> bugs.squeak.org/view.php?id=6512) I tested this code for  
> calculating the
> length of the String:
>
>     self log truncated + 1
>
> ...but that doesn't work. The current code in my ChangeSet uses an
> unrolled binary search (nested ifs) which is 7x faster
> (#decimalDigitLength) so the above code is not something we would  
> like to
> use, but I still wonder why it fails and what I would have needed  
> to do
> about it to get it to work:
>
> 999 log truncated  ===> 2         As expected.
>
> 1000 log           ===> 3.0       As expected.
>
> 1000 log truncated ===> 2         Eh, what? Not expected!
>
> ...ok, yes, I know - Floats are the "tar pits of hell" when it  
> comes to
> expected results - but... can someone answer if this is a bug or if I
> simply can't expect this code to work?


1000 log - 3.0 "-4.44089209850063e-16"

- Bert -





More information about the Squeak-dev mailing list