1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-11 16:22:26 +08:00

feat: add StdDev and fix bug of Average for math package

This commit is contained in:
dudaodong
2024-11-18 17:01:27 +08:00
parent 6b2c91b0f6
commit 8322951475
7 changed files with 218 additions and 88 deletions

View File

@@ -178,7 +178,7 @@ func ExampleAverage() {
fmt.Println(result2)
// Output:
// 1
// 1.5
// 1.3
}
@@ -490,3 +490,15 @@ func ExampleVariance() {
// 2
// 2.42
}
func ExampleStdDev() {
result1 := TruncRound(StdDev([]int{1, 2, 3, 4, 5}), 2)
result2 := TruncRound(StdDev([]float64{1.1, 2.2, 3.3, 4.4, 5.5}), 2)
fmt.Println(result1)
fmt.Println(result2)
// Output:
// 1.41
// 1.55
}