From febaea158bd1b2ddc297f053a211bcf5da0390e9 Mon Sep 17 00:00:00 2001 From: Leon Rische Date: Mon, 24 Feb 2020 13:39:52 +0100 Subject: Fix division by zero if there are no positions --- awk/stats_positions.awk | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'awk/stats_positions.awk') diff --git a/awk/stats_positions.awk b/awk/stats_positions.awk index 464cf5b..735013a 100644 --- a/awk/stats_positions.awk +++ b/awk/stats_positions.awk @@ -39,7 +39,14 @@ END { for (var in by_type) { print "type-" var "\t" by_type[var]; } - print "avg-ease" "\t" ease / n_stats; - print "avg-box" "\t" box / n_stats; - print "avg-interval" "\t" interval / n_stats; + + if (n_stats > 0) { + print "avg-ease" "\t" ease / n_stats; + print "avg-box" "\t" box / n_stats; + print "avg-interval" "\t" interval / n_stats; + } else { + print "avg-ease" "\t" 0.0; + print "avg-box" "\t" 0; + print "avg-interval" "\t" 0.0; + } } -- cgit v1.2.3