stefan pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=9c773ed5cf325e98a33457904e697aa8f313e9c8
commit 9c773ed5cf325e98a33457904e697aa8f313e9c8 Author: Stefan Schmidt <[email protected]> Date: Tue Jun 9 14:22:19 2020 +0200 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 <[email protected]> Differential Revision: https://phab.enlightenment.org/D11956 --- src/benchmarks/eina/ecore_hash.c | 9 ++++++--- 1 file 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) sum_n += (double)n; } } - variance = (sum_n_2 - ((sum_n * sum_n) / (double)i)) / (double)i; - printf("Average length: %f\n\tvariance^2: %f", (sum_n / (double)i), - variance); + if (i) + { + variance = (sum_n_2 - ((sum_n * sum_n) / (double)i)) / (double)i; + printf("Average length: %f\n\tvariance^2: %f", (sum_n / (double)i), + variance); + } } static int --
