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

Non-precise test cases / comparing numbers #448

Closed
fulldecent opened this issue Apr 25, 2021 · 2 comments
Closed

Non-precise test cases / comparing numbers #448

fulldecent opened this issue Apr 25, 2021 · 2 comments

Comments

@fulldecent
Copy link
Contributor

When creating test cases, it is best practice to NOT compare floating point values using an equality check.

Therefore, test cases like these are inappropriate: https://github.com/google/open-location-code/blob/master/test_data/decoding.csv#L26

Or, there should be a lot more documentation (in the test case) to explain why that specific value is expected.

References:

@drinckes
Copy link
Contributor

drinckes commented Jun 7, 2024

I'm not super happy with having floating point checks but we have to try to define a set of test cases that function across different languages with different precision capabilities and this is the best we came up with.

If you want to propose an alternative feel free. Otherwise I don't see this as something we need to address.

@drinckes drinckes closed this as completed Jun 7, 2024
@fulldecent
Copy link
Contributor Author

I did have the macros there as a proposed solution.

When doing a decoding test, we should not require the result to exactly equal the required test case.

Instead we should only require them to be within 0.00000001 of each other. Because on 32-bit systems numbers are considered equivalent if they are that close.

This issue can please stay open. I can contribute PRs. Working on this is blocked on updating the specification. Specifically if we are still supporting 32-bit implementations or only 64-bit. (Those will have slightly different ways to properly do the test case.)

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