1 Jun 2007 08:19
Re: Is this a buglet? (SmallInteger>>printString related)
Göran Krampe <goran <at> krampe.se>
2007-06-01 06:19:46 GMT
2007-06-01 06:19:46 GMT
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
RSS Feed