- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 169
Fix failing tests due to precision errors on arm64 #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix failing tests due to precision errors on arm64 #58
Conversation
Co-authored-by: nicoo <nicoo@debian.org> Bug-Debian: https://bugs.debian.org/976562 Bug: montanaflynn#33 Forwarded: no
FYI, this can be tested without access to a non-amd64 machine, using |
@anthonyfok I was hoping you'd have a suggestion for a better place to put test utilities than |
@nbraud Ha ha! I didn't look too closely at the rest of the patch / pull request yet, but in my limited (and abandoned) experiment, I named it |
correlation_test.go
Outdated
@@ -8,12 +8,13 @@ import ( | |||
"github.com/montanaflynn/stats" | |||
) | |||
|
|||
func ExampleCorrelation() { | |||
func ExampleCorrelation(l *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fails for older Go versions which won't accept an argument in an en Example test:
https://travis-ci.org/github/montanaflynn/stats/builds/749863684
correlation_test.go
Outdated
s1 := []float64{1, 2, 3, 4, 5} | ||
s2 := []float64{1, 2, 3, 5, 6} | ||
a, _ := stats.Correlation(s1, s2) | ||
fmt.Println(a) | ||
// Output: 0.9912407071619302 | ||
if !veryclose(a, 0.9912407071619302) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could use stats.Round
here with the same result and added benefit of showing off another exported function instead of a private function that cannot be copy / pasted as one would expect from an example.
Great work @Gu1nness and @nbraud, happy to see this solved! I see it failed tests for older Go versions: https://travis-ci.org/github/montanaflynn/stats/builds/749863684 and left some comments on how I think we could fix that and improve the example at the same time. I also agree with @anthonyfok that running Once the formatting and example changes are pushed I'll be glad to merge! |
I made the changes and added tests for arm64 on travisci, and they all passed! 🎉 I've also merged the PR into master, they will be included in a new tagged release soon. |
Co-authored-by: @nbraud
Fixes #33