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

Göran Krampe goran at krampe.se
Fri Jun 1 06:19:46 UTC 2007


Hi folks!

Messing with small scale optimization can be great fun. Preamble:

"Change Set:		FloorLogSmallInteger
Date:			31 May 2007
Author:			Göran Krampe

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:

http://www.hackersdelight.org/HDcode/ilog.c

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."


So the attachment is merely for amusement and/or info on the subject! :) :)

regards, Göran
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FloorLogSmallInteger.1.cs.gz
Type: application/x-gzip
Size: 656 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20070601/78a577dc/FloorLogSmallInteger.1.cs.bin


More information about the Squeak-dev mailing list