anchor.diff:  -spec new_fpr(MaxItems::non_neg_integer(), FPR::float(), ?REP_HFS:hfs())
           -> bloom_filter().
   new_fpr(MaxItems, FPR, Hfs) ->
  -    Size = resize(calc_least_size(MaxItems, FPR), 8),
  +    Size = resize(calc_least_size(MaxItems, FPR, ?REP_HFS:size(Hfs)), 8),
       new_(Size, Hfs).
   
   %% @doc Creates a new bloom filter with the default (optimal) hash function set
  
positive.code:     true.
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % Common bloom filter calculations
  %
  %       Definitions:
  %       N=BF maximum element number
  %       M=BF bit size
  %       C=Compression Rate M/N
  %       E=FPR 0<=E<=1 (FPR=false-positive rate)
  %       k=Number of hash functions
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  % @doc  Calculates optimal number of hash functions for
  %       an M-bit large BloomFilter with a maximum of N Elements.
  -spec calc_HF_num(pos_integer(), non_neg_integer()) -> pos_integer().
  calc_HF_num(M, N) ->
      calc_HF_num(util:ceil(M / erlang:max(N, 1))).
  
  % @doc Calculates optimal number of hash functions for
  %      a given compression rate of C.
  -spec calc_HF_num(pos_integer()) -> pos_integer().
  calc_HF_num(C) when C > 0 ->
      K = C * math:log(2),
      K_Min = util:floor(K),
      K_Max = util:ceil(K),
      A = calc_FPR(C, K_Max),
      B = calc_FPR(C, K_Min),
      case erlang:min(A, B) of
          A -> K_Max;
          B -> K_Min
      end.
  
  % @doc Calculates opt. number of hash functions to
  %      code N elements into a bloom filter with false positive rate of FPR.
  -spec calc_HF_numEx(non_neg_integer(), float()) -> pos_integer().
  calc_HF_numEx(N, FPR) ->
      M = calc_least_size(N, FPR),
      calc_HF_num(M, N).
  
  % @doc  Calculates leasts bit size of a bloom filter
  %       with a bounded false-positive rate FPR up to N-Elements.
  -spec calc_least_size(non_neg_integer(), float()) -> pos_integer().
  calc_least_size(_, FPR) when FPR == 0 -> 1;
  calc_least_size(0, _) -> 1;
  calc_least_size(N, FPR) ->
      util:ceil((N * util:log2(math:exp(1)) * util:log2(1 / FPR))).
  
  % @doc  Calculates FPR for an M-bit large bloom_filter with K Hashfuntions
  %       and a maximum of N elements.
  %       FPR = (1-e^(-kn/m))^k
  %       M = number of BF-Bits
  -spec calc_FPR(pos_integer(), pos_integer(), pos_integer()) -> float().
  calc_FPR(M, N, K) ->
      math:pow(1 - math:exp((-K * N) / M), K).
  
  -spec calc_FPR(pos_integer(), pos_integer()) -> float().
  calc_FPR(C, K) ->
      math:pow(1 - math:exp(-K / C), K).
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %% helper functions
  
negative.code:          add/2, add_list/2, is_element/2, item_count/1]).
  -export([equals/2, join/2, print/1]).
  
  -export([calc_HF_num/2, calc_HF_numEx/2,
           calc_least_size/3,
           calc_FPR/3]).
  
  % for tests:
  -export([get_property/2]).
  