Repository: couchdb-bear
Updated Branches:
  refs/heads/master 37909387d -> 008f48aff


Fix harmonic_mean behaviour when all values are 0 OR 0.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/88ff370b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-bear/tree/88ff370b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-bear/diff/88ff370b

Branch: refs/heads/master
Commit: 88ff370b8d859d390b20f62d797bfc03369851fd
Parents: 5f99806
Author: Seb Maynard <[email protected]>
Authored: Thu Aug 28 10:49:32 2014 +0100
Committer: Seb Maynard <[email protected]>
Committed: Thu Aug 28 10:49:32 2014 +0100

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


http://git-wip-us.apache.org/repos/asf/couchdb-bear/blob/88ff370b/src/bear.erl
----------------------------------------------------------------------
diff --git a/src/bear.erl b/src/bear.erl
index 3a7898f..b7ae3af 100644
--- a/src/bear.erl
+++ b/src/bear.erl
@@ -208,7 +208,8 @@ 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}) ->
+harmonic_mean(#scan_result{sumInv=Zero}) when Zero =:= 0 orelse
+                                              Zero =:= 0.0 ->
     %% Protect against divide by 0 if we have all 0 values
     0;
 harmonic_mean(#scan_result{n=N, sumInv=Sum}) ->

Reply via email to