mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 11:07:10 +00:00
refactor(analyze): hoist the sign test's loop bound
This commit is contained in:
1 parent
37e6298992
commit
8e8eb621c3
1 file changed
+2
-1
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user