]> git.sesse.net Git - stockfish/blobdiff - src/nnue/evaluate_nnue.cpp
Improve some comments
[stockfish] / src / nnue / evaluate_nnue.cpp
index a1a90023909f98f25826691d738ac838a33e551d..cff1d0243dbd0404b1fc95aeebd81a38693ad336 100644 (file)
@@ -82,6 +82,7 @@ namespace Stockfish::Eval::NNUE {
 
   }  // namespace Detail
 
+
   // Initialize the evaluation function parameters
   static void initialize() {
 
@@ -187,7 +188,6 @@ namespace Stockfish::Eval::NNUE {
 
     // We manually align the arrays on the stack because with gcc < 9.3
     // overaligning stack variables with alignas() doesn't work correctly.
-
     constexpr uint64_t alignment = CacheLineSize;
 
 #if defined(ALIGNAS_ON_STACK_VARIABLES_BROKEN)
@@ -224,7 +224,7 @@ namespace Stockfish::Eval::NNUE {
 
     buffer[0] = (v < 0 ? '-' : v > 0 ? '+' : ' ');
 
-    int cp = std::abs(100 * v / UCI::NormalizeToPawnValue);
+    int cp = std::abs(UCI::to_cp(v));
     if (cp >= 10000)
     {
         buffer[1] = '0' + cp / 10000; cp %= 10000;
@@ -249,21 +249,21 @@ namespace Stockfish::Eval::NNUE {
   }
 
 
-  // format_cp_aligned_dot() converts a Value into (centi)pawns, always keeping two decimals.
+  // format_cp_aligned_dot() converts a Value into pawns, always keeping two decimals
   static void format_cp_aligned_dot(Value v, std::stringstream &stream) {
-    const double cp = 1.0 * std::abs(int(v)) / UCI::NormalizeToPawnValue;
+  
+    const double pawns = std::abs(0.01 * UCI::to_cp(v));
 
     stream << (v < 0 ? '-' : v > 0 ? '+' : ' ')
            << std::setiosflags(std::ios::fixed)
            << std::setw(6)
            << std::setprecision(2)
-           << cp;
+           << pawns;
   }
 
 
   // trace() returns a string with the value of each piece on a board,
   // and a table for (PSQT, Layers) values bucket by bucket.
-
   std::string trace(Position& pos) {
 
     std::stringstream ss;