<commit_before>package accrual

import "math"

// CDF returns the cumulative distribution function if the given
// normal function, for the given value.
func cdf(μ, σ, v float64) float64 {
	return ((1.0 / 2.0) * (1 + math.Erf((v-μ)/(σ*math.Sqrt2))))
}

// Phi returns the φ-failure for the given value and distribution.
func phi(v float64, d []int64) float64 {
	μ := mean(d)
	σ := standardDeviation(d)
	return -math.Log10(1 - cdf(μ, σ, v))
}

// Mean returns the mean of the given sample.
func mean(values []int64) float64 {
	if len(values) == 0 {
		return 0.0
	}
	var sum int64
	for _, v := range values {
		sum += v
	}
	return float64(sum) / float64(len(values))
}

// StandardDeviation returns standard deviation of the given sample.
func standardDeviation(v []int64) float64 {
	return math.Sqrt(variance(v))
}

// Variance returns variance if the given sample.
func variance(values []int64) float64 {
	if len(values) == 0 {
		return 0.0
	}
	m := mean(values)
	var sum float64
	for _, v := range values {
		d := float64(v) - m
		sum += d * d
	}
	return float64(sum) / float64(len(values))
}<commit_msg>Remove extra type conversion<commit_after>package accrual

import "math"

// CDF returns the cumulative distribution function if the given
// normal function, for the given value.
func cdf(μ, σ, v float64) float64 {
	return ((1.0 / 2.0) * (1 + math.Erf((v-μ)/(σ*math.Sqrt2))))
}

// Phi returns the φ-failure for the given value and distribution.
func phi(v float64, d []int64) float64 {
	μ := mean(d)
	σ := standardDeviation(d)
	return -math.Log10(1 - cdf(μ, σ, v))
}

// Mean returns the mean of the given sample.
func mean(values []int64) float64 {
	if len(values) == 0 {
		return 0.0
	}
	var sum int64
	for _, v := range values {
		sum += v
	}
	return float64(sum) / float64(len(values))
}

// StandardDeviation returns standard deviation of the given sample.
func standardDeviation(v []int64) float64 {
	return math.Sqrt(variance(v))
}

// Variance returns variance if the given sample.
func variance(values []int64) float64 {
	if len(values) == 0 {
		return 0.0
	}
	m := mean(values)
	var sum float64
	for _, v := range values {
		d := float64(v) - m
		sum += d * d
	}
	return sum / float64(len(values))
}
{'fraction_non_alphanumeric': 0.13537906137184116, 'fraction_numerical': 0.04512635379061372, 'mean_word_length': 3.524489795918367, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6654846', 'n_tokens_mistral': 869, 'n_tokens_neox': 792, 'n_words': 267}