Last active
March 12, 2026 08:16
-
-
Save Deleplace/1a45e33b9027d4950fa6cd28341fed27 to your computer and use it in GitHub Desktop.
Reproduce OOM in stats.MannWhitneyUTest with NaN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package oom | |
| import ( | |
| "math" | |
| "testing" | |
| "github.com/aclements/go-moremath/stats" | |
| ) | |
| func TestMannWhitneyUTest_NaN_OOM(t *testing.T) { | |
| x1 := []float64{math.NaN()} | |
| x2 := []float64{1.0} | |
| res, err := stats.MannWhitneyUTest(x1, x2, stats.LocationDiffers) | |
| if err != nil { | |
| t.Fatalf("unexpected error: %v", err) | |
| } | |
| if !math.IsNaN(res.U) { | |
| t.Errorf("want U=NaN, got %v", res.U) | |
| } | |
| if !math.IsNaN(res.P) { | |
| t.Errorf("want P=NaN, got %v", res.P) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment