12 lines
204 B
Go
Executable File
12 lines
204 B
Go
Executable File
package maths
|
|
|
|
import "math"
|
|
|
|
func Mean(input Float64Data) (float64, error) {
|
|
if input.Len() == 0 {
|
|
return math.NaN(), EmptyInputErr
|
|
}
|
|
sum, _ := input.Sum()
|
|
return sum / float64(input.Len()), nil
|
|
}
|