From d32b2ca15bb2840ccf53d98a7088a3f01f8496a6 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 30 Aug 2015 20:49:36 +0100 Subject: 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. --- ezbench.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.3