anchor.diff:  
       #hyper{p = P, registers = Registers}.
   
  +
   encode_registers(M, Registers) ->
  -    ByteEncoded = lists:map(fun (I) ->
  -                                    case gb_trees:lookup(I, Registers) of
  -                                        {value, V} ->
  -                                            <<V:8/integer>>;
  -                                        none ->
  -                                            <<0>>
  -                                    end
  -                            end, lists:seq(0, M)),
  +    %% FIXME: shouldn't this be M-1 rather than M?
  +    ByteEncoded = encode_registers(M, Registers, []),
       base64:encode(
         zlib:gzip(
           iolist_to_binary(ByteEncoded))).
  +
  +encode_registers(I, _Registers, ByteEncoded) when I < 0 ->
  +    ByteEncoded;
  +
  +encode_registers(I, Registers, ByteEncoded) when I >= 0 ->
  +    Byte = case gb_trees:lookup(I, Registers) of
  +               {value, V} ->
  +                   <<V:8/integer>>;
  +               none ->
  +                   <<0>>
  +           end,
  +    encode_registers(I - 1, Registers, [Byte | ByteEncoded]).
  +
   
   decode_registers(B) ->
       ByteEncoded = zlib:gunzip(base64:decode(B)),
  
positive.code:     max(0.0, (card(Left) + card(Right)) - card(union(Left, Right))).
  
  
  
  -spec card(filter()) -> float().
  card(#hyper{registers = Registers, p = P}) ->
      M = trunc(pow(2, P)),
  
      RegisterSum = lists:sum(lists:map(fun (I) ->
                                                case gb_trees:lookup(I, Registers) of
                                                    {value, R} ->
                                                        pow(2, -R);
                                                    none ->
                                                        pow(2, -0)
                                                end
                                        end, lists:seq(0, M-1))),
  
      E = alpha(M) * pow(M, 2) / RegisterSum,
      Ep = case E =< 5 * M of
  
negative.code:              false -> E
           end,
  
      V = count_zeros(M-1, Registers, 0),
  
      H = case V of
              0 ->
                  Ep;
  