From: H. Felix Wittmann Date: Thu, 2 Jan 2014 12:00:48 +0000 (+0100) Subject: Ensure move_importance() is non-zero X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=8454d871ec105749fb5e2e7e9aea9e7c25cfdf6e;hp=153309e28702d8e5f49f4772bfb61f9f9ed965fc;ds=inline Ensure move_importance() is non-zero In case ply is very high, function will round to zero (although mathematically it is always bigger than zero). On my system this happens at movenumber 6661. Although 6661 moves in a game is, of course, probably impossible, for safety and to be locally consistent makes sense to ensure returned value is positive. Non functional change. --- diff --git a/src/timeman.cpp b/src/timeman.cpp index 9accfbb3..0348b677 100644 --- a/src/timeman.cpp +++ b/src/timeman.cpp @@ -18,6 +18,7 @@ */ #include +#include #include #include "search.h" @@ -44,7 +45,7 @@ namespace { double move_importance(int ply) { - return pow((1 + exp((ply - xshift) / xscale)), -skewfactor); + return pow((1 + exp((ply - xshift) / xscale)), -skewfactor) + DBL_MIN; // Ensure non-zero }