Merge pull request #561 from KristofferC/kc/divide_zero_csvexport

prevent divding by zero `csvexport` when number of zones is 1
This commit is contained in:
Bartosz Taudul 2023-05-17 14:44:54 +02:00 committed by GitHub
commit c31bda6e8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -337,7 +337,9 @@ int main(int argc, char** argv)
const auto ss = zone_data.sumSq const auto ss = zone_data.sumSq
- 2. * zone_data.total * avg - 2. * zone_data.total * avg
+ avg * avg * sz; + avg * avg * sz;
const auto std = sqrt(ss / (sz - 1)); double std = 0;
if( sz > 1 )
std = sqrt(ss / (sz - 1));
values[9] = std::to_string(std); values[9] = std::to_string(std);
std::string row = join(values, args.separator); std::string row = join(values, args.separator);