Currently the mean is calculated in a very naive way, which has numerical problems. Also it is possible to calculate the variance (and higher moments) in a single pass over the data, instead of two passes (see Wikipedia). (I implemented such an algorithm in Rust in this crate.)