round partial sum to avoid floating point errors
[barcat.git] / barcat
diff --git a/barcat b/barcat
index 319bc32826a65d60844f21a872dbefd2a8bef32e..0ab19d9c1159eb7349cf005cd52f0d6ebfc38e22 100755 (executable)
--- a/barcat
+++ b/barcat
@@ -308,7 +308,7 @@ say $opt{palette} ? color(0) : '' if $opt{spark};
 
 sub show_stat {
        if ($opt{hidemin} or $opt{hidemax}) {
-               printf '%s of ', sum(grep { length }
+               printf '%.8g of ', sum(grep { length }
                        @values[$opt{hidemin} .. ($opt{hidemax} || @lines) - 1]
                ) // 0;
        }