summaryrefslogtreecommitdiff
path: root/awk/stats_positions.awk
diff options
context:
space:
mode:
authorLeon Rische <leon.rische@me.com>2020-02-24 13:39:52 +0100
committerLeon Rische <leon.rische@me.com>2020-02-24 13:39:52 +0100
commitfebaea158bd1b2ddc297f053a211bcf5da0390e9 (patch)
tree1796f9101ee2bd676bb64d811b9254c1968b5b5f /awk/stats_positions.awk
parent8b0ec8b897c58d01e90e2fe82de81a8f531d5f66 (diff)
Fix division by zero if there are no positions
Diffstat (limited to 'awk/stats_positions.awk')
-rw-r--r--awk/stats_positions.awk13
1 files changed, 10 insertions, 3 deletions
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;
+ }
}