summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-08-30 20:49:36 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2015-09-09 09:53:00 +0100
commitd32b2ca15bb2840ccf53d98a7088a3f01f8496a6 (patch)
tree1eb201cc8cb00f5b4dce0c368f8c30e69fc2897b
parent9971ee98e480dd0dc8d7216281afe2308f392534 (diff)
core: Make geometric mean robust for large number of tests
Since using a multiplication of each test result can quickly exhaust the floating point range, convert it to a logarithmic addition.
-rwxr-xr-xezbench.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/ezbench.sh b/ezbench.sh
index af4a7cf..7bf48e4 100755
--- a/ezbench.sh
+++ b/ezbench.sh
@@ -406,7 +406,7 @@ do
# finish with the geometric mean (when we have multiple tests)
if [ $t -gt 1 ]; then
- fpsALL=$(awk '{r = 1; for(i=1; i<=NF; i++) { r *= $i } print exp(log(r) / NF) }' <<< $fpsALL)
+ fpsALL=$(awk '{r=0; for(i=1; i<=NF; i++) { r += log($i) } print exp(r / NF) }' <<< $fpsALL)
if [ -z "${testPrevFps[-1]}" ]; then
testPrevFps[-1]=$fpsALL
fi