diff options
-rw-r--r-- | EXPERIMENTAL-CHANGE-LOG | 1 | ||||
-rw-r--r-- | pts-core/functions/pts-functions.php | 24 |
2 files changed, 10 insertions, 15 deletions
diff --git a/EXPERIMENTAL-CHANGE-LOG b/EXPERIMENTAL-CHANGE-LOG index f77a8fd..a677406 100644 --- a/EXPERIMENTAL-CHANGE-LOG +++ b/EXPERIMENTAL-CHANGE-LOG @@ -3,6 +3,7 @@ PHORONIX TEST SUITE EXPERIMENTAL CHANGE-LOG Phoronix Test Suite (Git) - pts-core: Improve detection of graphics cards using common open-source drivers +- pts-core: Fix regression in pts_trim_double() that would return an array instead of float-formatted string - pts: Update espeak test profile with eSpeak engine 1.39 - pts: Change run-count for gtkperf test profile from 2000 to 5000 - pts_Graph: Write Y-axis title horizontally along the top of the graph instead of vertically diff --git a/pts-core/functions/pts-functions.php b/pts-core/functions/pts-functions.php index 0519d3d..95519bb 100644 --- a/pts-core/functions/pts-functions.php +++ b/pts-core/functions/pts-functions.php @@ -487,24 +487,18 @@ function pts_trim_double($double, $accuracy = 2) if(count($return) == 1) $return[1] = "00"; - else if(count($return) == 2) + + if(count($return) == 2 && $accuracy > 0) { - if($accuracy == 0) - { - $return = $return[0]; - } - else - { - $strlen = strlen($return[1]); + $strlen = strlen($return[1]); - if($strlen > $accuracy) - $return[1] = substr($return[1], 0, $accuracy); - else if($strlen < $accuracy) - for($i = $strlen; $i < $accuracy; $i++) - $return[1] .= '0'; + if($strlen > $accuracy) + $return[1] = substr($return[1], 0, $accuracy); + else if($strlen < $accuracy) + for($i = $strlen; $i < $accuracy; $i++) + $return[1] .= '0'; - $return = $return[0] . "." . $return[1]; - } + $return = $return[0] . "." . $return[1]; } else $return = $return[0]; |