Skip to content

Commit

Permalink
IHF: Rounding added.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-ivanov committed Jun 25, 2016
1 parent b7f3ae5 commit 93b48cd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ function format_bytes($bytes, $precision = 2)
$factor = floor(((strlen($bytes) - 1) / 3));
$factor = ($factor > $maxFactor) ? $maxFactor : $factor;

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

0 comments on commit 93b48cd

Please sign in to comment.