Basic bounded statistics. In the following, a bound
n is given stating
the number of periods over which to compute the statistic (
n == 1 computes
it only over the current period).
n must not overflow
for word size
a for streams over which computation is peformed.