From 19b70bd0538e2dae570096b24e8a3336b4f462b4 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 7 Feb 2001 17:10:32 +0000 Subject: (formatXiB): more precise for cases like 1_234_000 -> 1.2GB --- perl-install/common.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'perl-install') diff --git a/perl-install/common.pm b/perl-install/common.pm index 52d798365..350591534 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -611,7 +611,12 @@ sub formatXiB { $base >= 1024 ? ($newbase = $base / 1024) : ($newnb = $nb / 1024); }; foreach ('', _("KB"), _("MB"), _("GB")) { - $decr->(); $newnb >= 1 || $newnb * $newbase >= 1 or return int($nb * $base) . $_; + $decr->(); + if ($newnb < 1 && $newnb * $newbase < 1) { + my $v = $nb * $base; + my $s = $v < 10 && int(10 * $v - 10 * int($v)); + return int($v) . ($s ? ".$s" : '') . $_; + } } int($newnb * $newbase) . _("TB"); } -- cgit v1.2.1