From: Mischa POSLAWSKY Date: Fri, 6 Sep 2019 22:52:43 +0000 (+0200) Subject: graph length rounded to nearest integer X-Git-Tag: v1.03~2 X-Git-Url: http://git.shiar.nl/barcat.git/commitdiff_plain/aa4348908503da271484def8a17037c43e3095b5 graph length rounded to nearest integer Even distribution, and fixes unexpected overflows due to inexact float representation after size calculation (round decimals being decremented). --- diff --git a/graph b/graph index ea17d45..1a70964 100755 --- a/graph +++ b/graph @@ -123,7 +123,7 @@ while ($nr <= $#lines) { } my $line = $lines[$nr] =~ s/\n/$val/r; printf '%-*s', $len + length($val), $line; - print $barmark[$_] // '-' for 1 .. $size && (($values[$nr] || 0) - $minval) * $size; + print $barmark[$_] // '-' for 1 .. $size && (($values[$nr] || 0) - $minval) * $size + .5; say ''; $nr++; }