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

35 lines
559 B
Go
Executable File

package maths
import (
"fmt"
"math"
"strconv"
)
func StandardDeviationPopulation(input Float64Data) (sdev float64, err error) {
if input.Len() == 0 {
return math.NaN(), EmptyInputErr
}
vp, _ := PopulationVariance(input)
return math.Pow(vp, 0.5), nil
}
func DivideInt64(a, b int64) float64 {
if b == 0 {
return 0
}
return float64(a) / float64(b)
}
func DivideFloat64(a, b float64) float64 {
if b == 0 {
return 0
}
return a / b
}
func ToFloat64_b2(v float64) float64 {
f, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", v), 64)
return f
}