Mean of integers overflows - bug or expected behaviour?

Note that in some scenarios, this would lose precision that is currently available, eg

using Statistics
a = [8315191790773418, 41632452001999347, 25329529425389991, 123030457614227249,
     80417688995052453, 41883275111226319, 85784877512947606, 120202148107616837,
     99452431972860543, 115850321730795284]
mean(Float64.(a)) - mean(a) # -16.0

as it converts an inherently associative summation problem to a tricky one with floating point.

3 Likes