<commit_before>package main

import "math"

// Aggregation is a container for all summary statistics / aggregated data for 1 metric, in 1 time frame
// if the cnt is 0, the numbers don't necessarily make sense.
type Aggregation struct {
	min float64
	max float64
	sos float64
	sum float64
	cnt float64
	lst float64
}

func NewAggregation() *Aggregation {
	return &Aggregation{
		min: math.MaxFloat64,
	}
}

func (a *Aggregation) Add(ts uint32, val float64) {
	a.min = math.Min(val, a.min)
	a.max = math.Max(val, a.max)
	a.sos += math.Pow(val, 2)
	a.sum += val<commit_msg>fix: values can be negative! max would be broken for values <= 0<commit_after>package main

import "math"

// Aggregation is a container for all summary statistics / aggregated data for 1 metric, in 1 time frame
// if the cnt is 0, the numbers don't necessarily make sense.
type Aggregation struct {
	min float64
	max float64
	sos float64
	sum float64
	cnt float64
	lst float64
}

func NewAggregation() *Aggregation {
	return &Aggregation{
		min: math.MaxFloat64,
		max: -math.MaxFloat64,
	}
}

func (a *Aggregation) Add(ts uint32, val float64) {
	a.min = math.Min(val, a.min)
	a.max = math.Max(val, a.max)
	a.sos += math.Pow(val, 2)
	a.sum += val
{'fraction_non_alphanumeric': 0.10180623973727422, 'fraction_numerical': 0.03858784893267652, 'mean_word_length': 3.780392156862745, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2457532', 'n_tokens_mistral': 469, 'n_tokens_neox': 429, 'n_words': 156}