refactor(analyze): hoist the sign test's loop bound

This commit is contained in:
pj committed 2026-08-18 20:20:49 +05:30
1 parent 37e6298992
commit 8e8eb621c3
1 file changed
+2 -1
+2 -1
View File
@@ -24,8 +24,9 @@ func signTest(favouringFirst, favouringSecond int) float64 {
if trials == 0 {
return math.NaN()
}
smaller := min(favouringFirst, favouringSecond)
tail := 0.0
for count := 0; count <= min(favouringFirst, favouringSecond); count++ {
for count := 0; count <= smaller; count++ {
tail += math.Exp(logBinomialCoefficient(trials, count) - float64(trials)*math.Ln2)
}
return math.Min(2*tail, 1)