You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/07/31 23:09:58 UTC

[07/30] bear commit: updated refs/heads/import-master to 5f99806

Correct harmonic_mean behaviour all values are 0


Project: http://git-wip-us.apache.org/repos/asf/couchdb-bear/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-bear/commit/79782d28
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-bear/tree/79782d28
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-bear/diff/79782d28

Branch: refs/heads/import-master
Commit: 79782d28084a7c3463fcd8d5d267b350d822565d
Parents: b1882d7
Author: jamesc <ja...@opscode.com>
Authored: Fri Nov 30 13:35:27 2012 -0800
Committer: jamesc <ja...@opscode.com>
Committed: Fri Nov 30 13:35:27 2012 -0800

----------------------------------------------------------------------
 src/bear.erl | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-bear/blob/79782d28/src/bear.erl
----------------------------------------------------------------------
diff --git a/src/bear.erl b/src/bear.erl
index 33138ee..65b2831 100644
--- a/src/bear.erl
+++ b/src/bear.erl
@@ -146,6 +146,9 @@ arithmetic_mean(#scan_result{n=N, sumX=Sum}) ->
 geometric_mean(#scan_result{n=N, sumLog=SumLog}) ->
     math:exp(SumLog/N).
 
+harmonic_mean(#scan_result{sumInv=0}) ->
+    %% Protect against divide by 0 if we have all 0 values
+    0;
 harmonic_mean(#scan_result{n=N, sumInv=Sum}) ->
     N/Sum.