package mathext import "gogs.mikescher.com/BlackForestBytes/goext/langext" func AvgFloat64(arr []float64) float64 { return SumFloat64(arr) / float64(len(arr)) } func SumFloat64(arr []float64) float64 { sum := 0.0 for _, v := range arr { sum += v } return sum } func Max[T langext.OrderedConstraint](v1 T, v2 T) T { if v1 > v2 { return v1 } else { return v2 } } func Min[T langext.OrderedConstraint](v1 T, v2 T) T { if v1 < v2 { return v1 } else { return v2 } }