Fixed PMA_formatNumber() sometimes choosing too high SI preifx

This commit is contained in:
Tyron Madlener 2011-06-10 19:26:03 +02:00
parent 0f64babd3c
commit f4a2a92ea2

View File

@ -1438,11 +1438,11 @@ function PMA_formatNumber($value, $digits_left = 3, $digits_right = 0, $only_dow
$d = floor(log10($value) / 3);
// Lowering the SI prefix by 1 gives us an additional 3 zeros
// So if we have 3,6,9,12.. free zeros ($digits_left - $cur_digits) to use, then lower the SI prefix
$cur_digits = log10($value / PMA_pow(1000, $d, 'pow'))+1;
$cur_digits = floor(log10($value / PMA_pow(1000, $d, 'pow'))+1);
if($digits_left > $cur_digits) {
$d-= floor(($digits_left - $cur_digits)/3);
}
if($d<0 && $only_down) $d=0;
$value = round($value / (PMA_pow(1000, $d, 'pow') / $dh)) /$dh;