Skip to content
Permalink
Browse files
Merge pull request #9 from SemanticSugar/scan-values-float-fix
Add math_log/1 and inverse/1 patterns to catch 0.0
  • Loading branch information
joewilliams committed Jul 1, 2013
2 parents 3fd09d1 + 49cec9a commit 96cbfae62406e311bcfeb819ea46610eb38c5aff
Showing 1 changed file with 4 additions and 0 deletions.
@@ -317,12 +317,16 @@ foldl2(_F, Acc, [], []) ->
%% wrapper for math:log/1 to avoid dividing by zero
math_log(0) ->
1;
math_log(0.0) ->
1.0;
math_log(X) ->
math:log(X).

%% wrapper for calculating inverse to avoid dividing by zero
inverse(0) ->
0;
inverse(0.0) ->
0.0;
inverse(X) ->
1/X.

0 comments on commit 96cbfae

Please sign in to comment.