From 6f6b1b3ea121ab2c3144d9d6277ea84d6aea1f47 Mon Sep 17 00:00:00 2001 From: Daniel Bertalan Date: Mon, 5 Jul 2021 20:05:19 +0200 Subject: [PATCH] ChessEngine: Don't call non-constexpr `sqrt` in a constexpr intiializer GCC likely has a builtin intrinsic that evaluates the operation at compile-time, even if the `LibM` is not declared as constexpr. Clang, however, does not like it, and it failed to compile this code. --- Userland/Services/ChessEngine/MCTSTree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Services/ChessEngine/MCTSTree.h b/Userland/Services/ChessEngine/MCTSTree.h index 4241980822..6d522ccaf4 100644 --- a/Userland/Services/ChessEngine/MCTSTree.h +++ b/Userland/Services/ChessEngine/MCTSTree.h @@ -36,7 +36,7 @@ public: private: // While static parameters are less configurable, they don't take up any // memory in the tree, which I believe to be a worthy tradeoff. - static constexpr double s_exploration_parameter { sqrt(2) }; + static constexpr double s_exploration_parameter { M_SQRT2 }; // FIXME: Optimize simulations enough for use. static constexpr EvalMethod s_eval_method { EvalMethod::Heuristic };