# Fix algorithm for computation of standard deviation

From a discussion on MR 477 (!477 (comment 30754)):

I think the equation for stdTime_m is not correct. It should be std::sqrt((localMoments[l++] - totalNumParticles_m * std::pow(meanTime_m, 2)) * perParticle). However, this way of calculating can be numerically unstable (see also https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance).

I usually do a double loop, but that might be not so easy here. Perhaps with "Computing shifted data" with the first value taken as preliminary mean (this seems valid since the particle times are not expected to lie very far away from each other, or Welford's algorithm can be tried?