14 lines
211 B
Go
14 lines
211 B
Go
|
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
|
||
|
}
|