1
0
Fork 0
mirror of https://github.com/Luzifer/webcheck.git synced 2024-11-08 14:40:01 +00:00
webcheck/vendor/github.com/montanaflynn/stats/sum.go
Knut Ahlers 2fbabd6bd4
Vendor dependencies
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2018-07-23 14:54:12 +02:00

18 lines
268 B
Go

package stats
import "math"
// Sum adds all the numbers of a slice together
func Sum(input Float64Data) (sum float64, err error) {
if input.Len() == 0 {
return math.NaN(), EmptyInput
}
// Add em up
for _, n := range input {
sum += n
}
return sum, nil
}