$opt{width} ||= $ENV{COLUMNS} || 80;
$opt{color} //= -t *STDOUT; # enable on tty
$opt{trim} *= $opt{width} / 100 if $opt{trimpct};
$opt{width} ||= $ENV{COLUMNS} || 80;
$opt{color} //= -t *STDOUT; # enable on tty
$opt{trim} *= $opt{width} / 100 if $opt{trimpct};
- sprintf "%3.1f%1s", $_[0] / 1000 ** $unit, $opt{units}->[$unit];
+ sprintf "%3.1f%1s", $_[0] / 1000 ** $unit,
+ $#{$opt{units}} >> 1 < abs $unit ? "e$unit" : $opt{units}->[$unit];
Format values using SI unit prefixes,
turning long numbers like I<12356789> into I<12.4M>.
Format values using SI unit prefixes,
turning long numbers like I<12356789> into I<12.4M>.