I am using Windows 10 with 32GB memory and Mathematica 12.1 To be sure if the following is a bug, I would be glad if somebody can verify the following unexpected result.
sa := Total[RandomVariate[NormalDistribution[0, 1], 10]]^2/10;
n = 10^6;
Sum[sa, {i, n}]/n
n = 10^6 + 1;
Sum[sa, {i, n}]/n
We consider a sample of 10 from a Normal- distribution and calculate the expectation value of the variance using n samples. This gives reasonable results near 1 for n upto 10^6. But for n>10^6 the results are definitively wrong. It looks like an overflow in "Sum" to me.
Interestingly, I also get correct results if I calculate the data separately before summing up, so it seems more complicated than a simple overflow:
sa := Total[RandomVariate[NormalDistribution[0, 1], 10]]^2/10;
n = 10^6 + 1;
d = Table[sa, n];
Sum[d[[i]], {i, n}]/n
If I replace "Sum" by "Total" everything is o.k.