Author: Bruce Moreland
Date: 10:03:38 11/17/98
Go up one level in this thread
On November 17, 1998 at 10:23:19, Ernst Walet wrote:
>On November 17, 1998 at 08:38:40, Mark Young wrote:
>
>>I am running the position that Bruce posted, so I have be Running Rebel for many
>>hours under windows 98. I see that the node counter is showing
>> -1,944,662,209, and counting forward. Is this some kind of overflow error.
>
>Other programs can do the same, the variable for the node counter is
>overflowing. I've seen it with Tascbase on a K6-300 after about 18-20 hours.
In C, when you want to convert a 32-bit integer to a text string, in order that
you can display it on the screen, the way we'd all do it without thinking is:
sprintf(sz, "%ld", nodes);
This will mess up if "nodes" is between 2^31 and 2^32-1, it will print a
negative number. You can prevent this problem by doing:
sprintf(sz, "%lu", nodes);
That will handle numbers between 2^31 and 2^32-1 properly.
Problem is, that the world doesn't stop at 2^32-1, all you've done in this case
is double the amount of time until things break. Once you get more than 2^32-1,
you'll start over at zero.
An acceptable solution is to use a 64-bit number to count nodes. On current
machines, this will delay the advent of this problem for something on the order
of a million years.
bruce
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.