Odd place to make this remark.  Possibly better to open this block with: <code>
double variance = (count > 1) ? M2 / (count - 1) : 0;
/* if count is 1, we have no variation in our data */
</code>