The mean is computed from the running total and the item count. number items are averaged as IEEE 754 doubles and
bigint items as exact integers: a feed is expected to carry one numeric type throughout, and mixing the two is
reported rather than silently coerced.
bigint means are rounded to the nearest integer, halves away from zero, as no fractional bigint can carry the
remainder; callers needing another rounding, or a fractional mean, combine sum with count
themselves.
An empty feed resolves to undefined, as a mean over no items is not defined; callers wanting a default supply
it with ?? 0 or ?? 0n.
Warning
Exhaustive: every item is drawn before the sink resolves, so an infinite feed never completes.
Streaming: no more than the running total and count are held in memory, whatever the size of the feed.
Stateful: the mean covers the items drawn, so a sink closing a nested or truncated feed sees those alone.
Creates a sink averaging the items of the feed.
The mean is computed from the running total and the item count.
numberitems are averaged as IEEE 754 doubles andbigintitems as exact integers: a feed is expected to carry one numeric type throughout, and mixing the two is reported rather than silently coerced.bigintmeans are rounded to the nearest integer, halves away from zero, as no fractionalbigintcan carry the remainder; callers needing another rounding, or a fractional mean, combine sum with count themselves.An empty feed resolves to
undefined, as a mean over no items is not defined; callers wanting a default supply it with?? 0or?? 0n.