Author: Gerd Isenberg
Date: 10:22:42 10/31/03
Go up one level in this thread
On October 31, 2003 at 11:45:56, Sune Fischer wrote: >On October 31, 2003 at 09:04:41, Charles Roberson wrote: > >> >> I have a list of numbers that I wanted to normalize to the range of 0-100. >> The numbers are integers so the obvious thought is >> find largest >> foreach number >> number = number*100/largest >> >> However, division is slow. So, I dropped the range to 0-64 and >> came up with the following: >> find largest >> n = 7; >> if largest > 64 >> n = highorder bit position (largest) + 1; >> foreach number >> number = number>>n >> >> In some cases the range will be 0-32 but that is ok. >> Seems this should be fast and I haven't thought of anything faster. > >If possible, try and design around it. >Such heavy math shouldn't be needed in a chess program IMO, simpler schemes will >often be 10 times faster and 95% as good. > >Maybe there is some way you can generate the numbers to fall in the right range >directly (if the numbers are computed from tables, maybe try changing the tables >etc..)? > >-S. Probably right. I had a similar problem with history counters and assigning history scores to move scores. I did it by counting overflows, accepting some degree of saturation, and if the number of history overflows exceed some limit, i divide the whole history array by two. Gerd
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.