Calculating variance with large numbers
问题 I haven't really used variance calculation that much, and I don't know quite what to expect. Actually I'm not too good with math at all. I have a an array of 1000000 random numeric values in the range 0-10000. The array could grow even larger, so I use 64 bit int for sum. I have tried to find code on how to calc variance, but I don't know if I get correct output. The mean is 4692 and median is 4533. I get variance 1483780.469308 using the following code: // size is the element count, in this