]> git.sesse.net Git - stockfish/commitdiff
Fix build error on OSX
authorJoost VandeVondele <Joost.VandeVondele@gmail.com>
Mon, 21 Jun 2021 06:23:50 +0000 (08:23 +0200)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Mon, 21 Jun 2021 21:14:58 +0000 (23:14 +0200)
directly use integer version for cp calculation.

fixes https://github.com/official-stockfish/Stockfish/issues/3573

closes https://github.com/official-stockfish/Stockfish/pull/3574

No functional change

src/nnue/evaluate_nnue.cpp

index a918b9255ea8f205d260aee7cf90eb47638f4b6d..8828ae517e362f34422544c8667fed6e27d9945a 100644 (file)
@@ -232,7 +232,7 @@ namespace Stockfish::Eval::NNUE {
 
     buffer[0] = (v < 0 ? '-' : v > 0 ? '+' : ' ');
 
-    int cp = (int)(std::abs(100.0 * double(v) / PawnValueEg));
+    int cp = std::abs(100 * v / PawnValueEg);
 
     if (cp >= 10000)
     {
@@ -261,7 +261,7 @@ namespace Stockfish::Eval::NNUE {
   static void format_cp_aligned_dot(Value v, char* buffer) {
     buffer[0] = (v < 0 ? '-' : v > 0 ? '+' : ' ');
 
-    int cp = (int)(std::abs(100.0 * double(v) / PawnValueEg));
+    int cp = std::abs(100 * v / PawnValueEg);
 
     if (cp >= 10000)
     {