From 2481ea27ce0f423f3e6f3522539d20e1500cf572 Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Mon, 2 Apr 2018 23:51:08 +0200 Subject: Fix many issues reported by clang-tidy (#7189) * Fix many issues reported by clang-tidy We have many issues in code related to some performance to float <-> double. Clang-tidy reported it in performance-type-promotion-in-math-fn I fixed many of them. It's not ready for a promote to blocking Also fix some value which should be const-ref --- src/unittest/test_random.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/unittest/test_random.cpp') diff --git a/src/unittest/test_random.cpp b/src/unittest/test_random.cpp index bbee57719..14de764e1 100644 --- a/src/unittest/test_random.cpp +++ b/src/unittest/test_random.cpp @@ -19,6 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "test.h" +#include #include "util/numeric.h" #include "exceptions.h" #include "noise.h" @@ -157,7 +158,7 @@ void TestRandom::testPcgRandomNormalDist() int range = (max - min + 1); float mean = (max + min) / 2; float variance = ((range * range - 1) / 12) / num_trials; - float stddev = sqrt(variance); + float stddev = std::sqrt(variance); static const float prediction_intervals[] = { 0.68269f, // 1.0 @@ -180,7 +181,7 @@ void TestRandom::testPcgRandomNormalDist() accum += bins[j - min]; float actual = (float)accum / num_samples; - UASSERT(fabs(actual - prediction_intervals[i]) < 0.02); + UASSERT(std::fabs(actual - prediction_intervals[i]) < 0.02f); } } -- cgit v1.2.3