goext/lang/mathext/math.go

14 lines
211 B
Go
Raw Normal View History

2022-10-27 16:00:57 +02:00
package mathext
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
}