1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 08:43:09 +00:00

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.
This commit is contained in:
H. Felix Wittmann 2014-01-02 13:00:48 +01:00 committed by Marco Costalba
parent 153309e287
commit 8454d871ec

View file

@ -18,6 +18,7 @@
*/ */
#include <algorithm> #include <algorithm>
#include <cfloat>
#include <cmath> #include <cmath>
#include "search.h" #include "search.h"
@ -44,7 +45,7 @@ namespace {
double move_importance(int ply) { 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
} }