the smallest value selected for mode
@@ -108,7 +108,8 @@ func (a *numericalAggregator) buildPairsFromCounts() {
a.pairs = append(a.pairs, make([]floatCountPair, 0, len(a.valueCounter))...)
for value, count := range a.valueCounter {
- if count > a.maxCount {
+ // get one with higher count or lower value if counts are equal
+ if count > a.maxCount || (count == a.maxCount && value < a.mode) {
a.maxCount = count
a.mode = value
}
