Correctly output binary prefix values since base 2 is used for conversion

This commit is contained in:
Marek Bachmann 2022-11-30 04:37:08 +01:00
parent 75b01f669a
commit a3d8a59b00

View file

@ -225,7 +225,7 @@ class Strings
return INF; return INF;
} }
$units = ['B', 'KB', 'MB', 'GB', 'TB']; $units = ['B', 'KiB', 'MiB', 'GiB', 'TiB'];
$bytes = max($bytes, 0); $bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1024)); $pow = floor(($bytes ? log($bytes) : 0) / log(1024));
$pow = min($pow, count($units) - 1); $pow = min($pow, count($units) - 1);