From 6c74531408cab6d2f19f4bd0f71e3df69c328c85 Mon Sep 17 00:00:00 2001 From: Kim Walisch Date: Sun, 12 Nov 2017 12:02:13 +0100 Subject: [PATCH] Fix i386 bug Use std::log2(x) instead of std::log(x)/std::log(2.0) for improved accuracy. --- test/floorPow2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/floorPow2.cpp b/test/floorPow2.cpp index 939ca25e8..cf869dd73 100644 --- a/test/floorPow2.cpp +++ b/test/floorPow2.cpp @@ -27,7 +27,7 @@ void check(bool OK) uint64_t floorPow2_cmath(uint64_t n) { - return 1ull << (uint64_t) (log((double) n) / log(2.0)); + return 1ull << (uint64_t) log2(n); } int main()