xsum_weighted_mean() computes sum(w * x) and sum(w) exactly, each
rounded once, and divides. The result therefore has three roundings:
the two sums and the division. Each sum is exact, which removes the
cancellation and accumulation error that dominates sum(w * x) / sum(w);
an exact ratio of two superaccumulators is not available.
Details
With na.rm = TRUE, pairs where x is NA or NaN are removed, as in
stats::weighted.mean(); NA weights are not removed.
See also
Other means:
xsum_mean()