mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 17:16:33 +08: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:
committed by
Marco Costalba
parent
153309e287
commit
8454d871ec
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user