From 8454d871ec105749fb5e2e7e9aea9e7c25cfdf6e Mon Sep 17 00:00:00 2001 From: "H. Felix Wittmann" Date: Thu, 2 Jan 2014 13:00:48 +0100 Subject: [PATCH 1/1] 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. --- src/timeman.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 } -- 2.39.2