summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2020-06-09 14:22:19 +0200
committerStefan Schmidt <s.schmidt@samsung.com>2020-06-17 14:06:17 +0200
commit9c773ed5cf325e98a33457904e697aa8f313e9c8 (patch)
tree9a9a8666e2fe00f7d07ad280cebf7d46383dfaf9
parent794c52d2009b603b89eb4da53afc7ab8f9c5547d (diff)
benchmarks: eina: make sure we do not divide by zero
Make sure we do not divide by i if it is zero here. CID: 1400768 Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11956
-rw-r--r--src/benchmarks/eina/ecore_hash.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/benchmarks/eina/ecore_hash.c b/src/benchmarks/eina/ecore_hash.c
index ae9befa6b5..24ff219029 100644
--- a/src/benchmarks/eina/ecore_hash.c
+++ b/src/benchmarks/eina/ecore_hash.c
@@ -429,9 +429,12 @@ ecore_hash_dump_stats(Ecore_Hash *hash)
429 sum_n += (double)n; 429 sum_n += (double)n;
430 } 430 }
431 } 431 }
432 variance = (sum_n_2 - ((sum_n * sum_n) / (double)i)) / (double)i; 432 if (i)
433 printf("Average length: %f\n\tvariance^2: %f", (sum_n / (double)i), 433 {
434 variance); 434 variance = (sum_n_2 - ((sum_n * sum_n) / (double)i)) / (double)i;
435 printf("Average length: %f\n\tvariance^2: %f", (sum_n / (double)i),
436 variance);
437 }
435} 438}
436 439
437static int 440static int