Nodes per second? You mean this line of code:syzygy wrote:It is complete nonsense to suggest that the time allocation code of stockfish is derived from fruit's. But OK, apparently you also have a problem with stockfish.hyatt wrote:Some have already pointed out that stockfish might have "fruity" origins. however, since they have not competed in CC events, and since they release their code as GPL, they have followed the letter/spirit of the law quite carefully.
Not a reason at all not to use floats for time allocation calculations. In fact a complete non-reason.But if you look around at original engines, MOST use ints. Because of this:
in unix, best choice is "gettimeofday" to get the elapsed (wall-clock time).
Call looks like this:
int gettimeofday(struct timeval *tv, struct timezone *tz);
Guess what you find when you look inside the timeval struct definition?
Hint: NOT a float.
Do you actually understand why stockfish uses float? Hint: same reason as why crafty uses them for the calculation of nps. If you understand why, can you give any reason why NOT to use floats?
nodes_per_second =
tree->nodes_searched * 100 / (uint64_t) (end_time - start_time);
Not a single float in the bunch. All done using 64 bit integers. I am not sure what, exactly, you are talking about. I use a float to print time values, since my internal integer time is in 1/100ths of a second units exactly as provided by xboard. Much easier to print fractions of a second using a simple float(t) / 100.0 and then outputting on a %f format. Not to do anything other than display fractions of a second for test positions that take < 1 minute to search...
So can you be more specific about what you are suggesting here?
Neither do I worry about integer overflow. I can not search a number of nodes that threatens to overflow a 64 bit counter when doing any sort of calculation I can think of today. 4,000,000,000 x 4,000,000,000 is quite a large number.
Floats provide a very clear benefit here: the programmer doesn't have to worry about integer overflow problems in intermediate calculations.
Nothing to do with Vas whatsoever, in this case.
(Actually I can give a reason why not to use them: using one floating-point operation in an otherwise int-based program could theoretically increase context switch overhead. I don't know if this is still relevant with modern sse instruction sets, and in any case it will not be noticeable in practice. Still, this is the (only) reason why my engine doesn't use floats anywhere.)
Btw, what do you think of the following line:The variable time_limit is an int, but this line is clearly using floating point operations. It converts ints to floats, does some computation, and converts back to int. Guess what engine this comes from.Code: Select all
time_limit *= 1.0 + usage_level / 100.0;
Is this supposed to be logically coherent? The 0.0 makes no sense whatever its explanation. But it is there.hyatt wrote:Here's the key. 0.0 is in the line of code. Fruit has >=, Rybka has > which is different. If Vas copied Fruit and changed the >= to > then why didn't he notice the 0.0??? If he wrote the line himself, why didn't he fix the 0.0? The bottom line is, in spite of all the arguments, 0.0 is not something that happens naturally, there is no real keyboard/typo explanation that holds water, so why is it there? The most likely explanation is that it was copied and not noticed. Just another piece of a pretty large puzzle...
Maybe you accidentally left out the precondition for all your reasoning: VIG.