Skip to content

Commit

Permalink
Cast to float in format_number(). Fixes #14236
Browse files Browse the repository at this point in the history
  • Loading branch information
jim-p committed Apr 7, 2023
1 parent c016fea commit 2eb2597
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/etc/inc/util.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2119,16 +2119,15 @@ function format_number($num, $precision = 3) {
$units = array('', 'K', 'M', 'G', 'T');

$i = 0;
while ($num > 1000 && $i < count($units)) {
$num /= 1000;
while ((float) $num > 1000 && $i < count($units)) {
(float) $num /= 1000;
$i++;
}
$num = round($num, $precision);
$num = round((float) $num, $precision);

return ("$num {$units[$i]}");
return ("{$num} {$units[$i]}");
}


function unformat_number($formated_num) {
$num = strtoupper($formated_num);

Expand Down

0 comments on commit 2eb2597

Please sign in to comment.