From 8e8eb621c3c4fc649a0eb5db3b234ae950b4ce2c Mon Sep 17 00:00:00 2001 From: PJ Date: Tue, 18 Aug 2026 20:20:49 +0530 Subject: [PATCH] refactor(analyze): hoist the sign test's loop bound --- cmd/internal-tools/analyze/paired.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/internal-tools/analyze/paired.go b/cmd/internal-tools/analyze/paired.go index f45eb15..7b75e36 100644 --- a/cmd/internal-tools/analyze/paired.go +++ b/cmd/internal-tools/analyze/paired.go @@ -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)