summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-10-14 21:59:39 -0400
committerMichael Larabel <michael@phx-laptop.(none)>2008-10-14 21:59:39 -0400
commitd7dc3896cfff1e5f86c470916b964b441ab1a75c (patch)
tree3e1c126fdb095cdc55d7a694a6c5a90d827d4ff3
parent8174970602cc5bab2753cb41a477ba9fb160cb54 (diff)
downloadphoronix-test-suite-upstream-d7dc3896cfff1e5f86c470916b964b441ab1a75c.tar.gz
phoronix-test-suite-upstream-d7dc3896cfff1e5f86c470916b964b441ab1a75c.tar.xz
phoronix-test-suite-upstream-d7dc3896cfff1e5f86c470916b964b441ab1a75c.zip
pts-core: Fix regression in pts_trim_double() that would return an
array instead of float-formatted string
-rw-r--r--EXPERIMENTAL-CHANGE-LOG1
-rw-r--r--pts-core/functions/pts-functions.php24
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];