Is this a buglet? (SmallInteger>>printString related)
ncellier at ifrance.com
Fri Jun 1 11:19:46 UTC 2007
Göran Krampe <goran <at> krampe.se> writes:
> After messing with SmallInteger>>decimalDigitLength and noticing that
> '1000 log truncated' returns the wrong answer I ended up chasing down
> base-10 log algorithms. Found this nice source of tricks:
> And based on code in there and the fact that nlz (number of leading zeros)
> can be computed using 'self asFloat exponent' I came up with this
> implementation of #floorLog for SmallIntegers. It still is not as fast as
> simpleminded comparisons as in decimalDigitLength though so it is not
> worth using. But it was fun to experiment."
Yes, this link is fun.
Also don't forget Smalltalk has #highBit,
a complement of nlz not involving Float.
More information about the Squeak-dev