Fix some messy formatting in catch_stats

This commit is contained in:
Martin Hořeňovský 2022-03-06 11:02:20 +01:00
parent 05d4ec62c8
commit f206162b2d
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
2 changed files with 12 additions and 7 deletions

View File

@ -119,10 +119,14 @@ using Catch::Benchmark::Detail::sample;
double standard_deviation(std::vector<double>::iterator first, std::vector<double>::iterator last) { double standard_deviation(std::vector<double>::iterator first, std::vector<double>::iterator last) {
auto m = Catch::Benchmark::Detail::mean(first, last); auto m = Catch::Benchmark::Detail::mean(first, last);
double variance = std::accumulate(first, last, 0., [m](double a, double b) { double variance = std::accumulate( first,
last,
0.,
[m]( double a, double b ) {
double diff = b - m; double diff = b - m;
return a + diff * diff; return a + diff * diff;
}) / (last - first); } ) /
( last - first );
return std::sqrt( variance ); return std::sqrt( variance );
} }

View File

@ -109,7 +109,8 @@ namespace Catch {
double z1 = normal_quantile((1. - confidence_level) / 2.); double z1 = normal_quantile((1. - confidence_level) / 2.);
auto cumn = [n]( double x ) -> int { auto cumn = [n]( double x ) -> int {
return std::lround(normal_cdf(x) * n); }; return std::lround( normal_cdf( x ) * n );
};
auto a = [bias, accel](double b) { return bias + b / (1. - accel * b); }; auto a = [bias, accel](double b) { return bias + b / (1. - accel * b); };
double b1 = bias + z1; double b1 = bias + z1;
double b2 = bias - z1; double b2 = bias - z1;