anchor.diff:  %%      This is based on p0e(total) = (1 - p1e(total)) = p0e(each)^n = (1 - p1e(each))^n.
   -spec calc_n_subparts_p1e(N::number(), P1E::float(), PrevP0::float())
           -> P1E_sub::float().
  -calc_n_subparts_p1e(N, P1E, 1.0) when N == 1 andalso P1E > 0 andalso P1E < 1 ->
  +calc_n_subparts_p1e(N, P1E, 0.0) when N == 1 andalso P1E > 0 andalso P1E < 1 ->
       % special case with e.g. no items in the first/previous phase
       P1E;
  -calc_n_subparts_p1e(N, P1E, PrevP0E) when P1E > 0 andalso P1E < 1.0e-8 andalso
  -                                              PrevP0E > 0 andalso PrevP0E =< 1 ->
  +calc_n_subparts_p1e(N, P1E, PrevP1E) when P1E > 0 andalso P1E < 1.0e-8 andalso
  +                                              PrevP1E >= 0 andalso PrevP1E < 1 ->
       % BEWARE: we cannot use (1-p1E) since it is near 1 and its floating
       %         point representation is sub-optimal!
       % => use Taylor expansion of 1 - ((1 - p1e) / PrevP0E)^(1/n)  at P1E = 0
       % http://www.wolframalpha.com/input/?i=Taylor+expansion+of+1+-+%28%281+-+p%29%2Fq%29^%281%2Fn%29++at+p+%3D+0
       N2 = N * N, N3 = N2 * N, N4 = N3 * N, N5 = N4 * N,
       P1E2 = P1E * P1E, P1E3 = P1E2* P1E, P1E4 = P1E3 * P1E, P1E5 = P1E4 * P1E,
  -    Q1 = math:pow(1 / PrevP0E, 1 / N),
  -    VP = (1 - Q1) + (P1E * Q1) / N +
  +    % find a (somewhat) better representation of Q1 and Q0=1-Q1:
  +%%  Q1 = math:pow(1 / (1 - PrevP1E), 1 / N),
  +%%  Q0 = 1 - Q1,
  +    P2 = PrevP1E * PrevP1E, P3 = P2 * PrevP1E, P4 = P3 * PrevP1E, P5 = P4 * PrevP1E,
  +    Q0 = -PrevP1E / N - (P2 * (N+1)) / (2 * N2) -
  +             (P3 * (2 * N2 + 3 * N + 1)) / (6 * N3) -
  +             (P4 * (6 * N3 + 11 * N2 + 6 * N + 1)) / (24 * N4) -
  +             (P5 * (24 * N4 + 50 * N3 + 35 * N2 + 10 * N + 1)) / (120 * N5), %+O[p^6]
  +    Q1 = 1 - Q0,
  +    VP = Q0 + (P1E * Q1) / N +
                 ((N-1) * P1E2 * Q1) / (2 * N2) +
                 ((N-1) * (2 * N - 1) * P1E3 * Q1) / (6 * N3) +
                 ((N-1) * (2 * N - 1) * (3 * N - 1) * P1E4 * Q1) / (24 * N4) +
  -              ((N-1) * (2 * N - 1) * (3 * N - 1) * (4 * N - 1) * P1E5 * Q1) / (120 * N5), % +O[p^6]
  +              ((N-1) * (2 * N - 1) * (3 * N - 1) * (4 * N - 1) * P1E5 * Q1) / (120 * N5), % +O[P1E^6]
       if VP > 0 andalso VP < 1 ->
              VP;
          VP =< 0 ->
  
positive.code:     {OBucketTree, _OrigDBChunkLen, VSize} =
          decompress_kv_list({OBucketKBin, OBucketVBin}, SigSize),
      {NHashesK, NHashesV, OBucketTree, BucketSize, SigSize, VSize,
       NextP0E, NextP1E_real}.
  
  %% @doc Creates a compact binary consisting of bitstrings with trivial
  %%      reconciliations for all sync requests to send.
  -spec merkle_resolve_leaves_send(State::state(), NextP0E::float()) -> NewState::state().
  merkle_resolve_leaves_send(
    State = #rr_recon_state{params = Params, initiator = IsInitiator,
                            stats = Stats, dest_recon_pid = DestReconPid,
                            dest_rr_pid = DestRRPid,   ownerPid = OwnerL,
                            merkle_sync = {SyncSend, SyncRcv, SyncRcvLeafCount,
                                           {MySyncDRK, MySyncDRLCount, OtherSyncDRLCount}}},
    NextP0E) ->
  %%     log:pal("Sync (~s):~n  send:~.2p~n  rcv:~.2p",
  %%             [?IIF(IsInitiator, "I", "NI"), SyncSend, SyncRcv]),
      % resolve items from emptyLeaf-* comparisons with empty leaves on any node as key_upd:
  
negative.code:                                                 Params#merkle_params.bucket_size),
                    {NHashesKAcc, NHashesVAcc, ToSend1, ToResolve1,
                     ?IIF(ReqIdx =/= [], true, ResolveNonEmpty),
                     TProcsAcc - 1, ThisP1E, ThisP1E_real}
            end, {HashesK, HashesV, [], [], false, TrivialProcs, 0.0, 0.0}, SyncRcv),
  
      % send resolve message:
      % resolve items we should send as key_upd:
  