Skip to content
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

TestParseDecimal/5.1 no longer passes #115

Closed
QuLogic opened this issue Oct 30, 2023 · 3 comments
Closed

TestParseDecimal/5.1 no longer passes #115

QuLogic opened this issue Oct 30, 2023 · 3 comments

Comments

@QuLogic
Copy link

QuLogic commented Oct 30, 2023

This is probably dependent on architecture in some way, or floating-point optimizations. I am running on a now somewhat older x86_64 though, so it's not too esoteric.

--- FAIL: TestParseDecimal (0.00s)
    --- FAIL: TestParseDecimal/5.1 (0.00s)
    decimal_test.go:26: 5.1000000000000005 != 5.1

This occurs with the older github.com/tdewolff/test 1.0.9 that had absolute comparisons, or with the newer 1.0.10 that has relative comparisons.

@tdewolff
Copy link
Owner

Thanks for the report. Can't figure out what's wrong here, with Epsilon = 1e-10:

Absolute: 5.1000000000000005 - 5.1 = 5e-16 < 1e-10

Relative: (5.1000000000000005 - 5.1) / 5.1 ≈ 1e-16 < 1e-10

For both cases the test should pass (as it does on my computer), not sure what is wrong...

@tdewolff
Copy link
Owner

tdewolff commented Nov 1, 2023

Pushed out a change in the test package, maybe that fixes it?

@QuLogic
Copy link
Author

QuLogic commented Nov 5, 2023

Thanks, it looks like 2.7.1 works, and I didn't need to use the intermediate commit of the test package.

Edit: And also 2.7.4 works, without the change to test as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants