Files
huangguo_server/common/maths/mean.go
T
rootandClaude Opus 5 8679200f41 Initial commit
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 13:57:10 +08:00

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
}