You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am dealing with a large distribution of values. In your mean calculation here total overflows because you keep adding without keeping it down. May I suggest to use a running mean? Because this is anyway an approximate mean, the rounding error that occurs should be negligible.
// Mean returns the approximate arithmetic mean of the recorded values.func (h*Histogram) Mean() float64 {
ifh.totalCount==0 {
return0
}
vartotalint64i:=h.iterator()
fori.next() {
ifi.countAtIdx!=0 {
total+=i.countAtIdx*h.medianEquivalentValue(i.valueFromIdx)
}
}
returnfloat64(total) /float64(h.totalCount)
}
The text was updated successfully, but these errors were encountered:
I am dealing with a large distribution of values. In your mean calculation here
total
overflows because you keep adding without keeping it down. May I suggest to use a running mean? Because this is anyway an approximate mean, the rounding error that occurs should be negligible.The text was updated successfully, but these errors were encountered: