git.shiar.nl
/
barcat.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix sival log for negative/zero values
[barcat.git]
/
barcat
diff --git
a/barcat
b/barcat
index a664d0ddec200f0762e5a3a6ea1d269c5baf571b..48464342d6f2d2053fe28fb1f835ea9b364136c8 100755
(executable)
--- a/
barcat
+++ b/
barcat
@@
-143,7
+143,7
@@
if ($opt{markers} // 1 and $size > 0) {
@lines > $nr or return if $opt{hidemin};
sub sival {
@lines > $nr or return if $opt{hidemin};
sub sival {
- my $unit = int(log(
$_[0]
) / log(1000) - ($_[0] < 1) + 1e-15);
+ my $unit = int(log(
abs $_[0] || 1
) / log(1000) - ($_[0] < 1) + 1e-15);
my $float = sprintf '%e', $_[0] / 1000 ** $unit; #TODO: or $_[0] =~ /\./
$float -= int($float);
sprintf('%*.*f%*s',
my $float = sprintf '%e', $_[0] / 1000 ** $unit; #TODO: or $_[0] =~ /\./
$float -= int($float);
sprintf('%*.*f%*s',