Skip to content

Commit 93b48cd

Browse files
committed
IHF: Rounding added.
1 parent b7f3ae5 commit 93b48cd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/format.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ function format_bytes($bytes, $precision = 2)
99
$factor = floor(((strlen($bytes) - 1) / 3));
1010
$factor = ($factor > $maxFactor) ? $maxFactor : $factor;
1111

12-
return sprintf("%.{$precision}f", ($bytes / pow(1024, $factor))) . $units[$factor];
12+
return round(($bytes / pow(1024, $factor)), $precision) . $units[$factor];
1313
}
1414
}

0 commit comments

Comments
 (0)