From 366711cee3303e371a2c1878119042af56ba09cb Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Wed, 18 Jul 2018 10:19:19 +0200 Subject: [PATCH] marsadm: better human-readable units --- userspace/marsadm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/userspace/marsadm b/userspace/marsadm index 7b8f5ed5..17695f87 100755 --- a/userspace/marsadm +++ b/userspace/marsadm @@ -3536,10 +3536,11 @@ sub number2human { my ($number, $unit, $max) = @_; $max = $number if !defined($max); my $k = 1024.0; + my $flip_over = 9.99; if (!defined($unit) || !$unit) { - if ($max >= $k * $k * $k * $k) { + if ($max >= $k * $k * $k * $k * $flip_over) { $unit = "T"; - } elsif ($max >= $k * $k * $k) { + } elsif ($max >= $k * $k * $k * $flip_over) { $unit = "G"; } elsif ($max >= $k * $k) { $unit = "M";