-
Notifications
You must be signed in to change notification settings - Fork 477
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
Use Mac for testing edge cases differing across processors #665
base: main
Are you sure you want to change the base?
Conversation
Can you change the PR title to describe what it is doing, and the comment to describe why please. |
We always knew that different architectures/implementations would give different results due to different floating point implementations, but the question is, what do we do about it? Modifying all the OLC functions to take integers would make writing our test cases easier, but at the expense of making more work for users (because they have to remember to multiple everything by 1e7 for example). The floating point precision issues remain, they just become not our problems, but that's not really a solution. One possible solution is to migrate the C (and maybe C++) implementations to using an arbitrary precision library such as MPFR. I have created #669 to discuss, and in the meanwhile I propose closing this PR without merging? |
Regardless of which solution is picked, we may want to keep the Mac test target for the long-term. It identified a math issue in the implementations and it may identify build issues in the future or provide other useful feedback. |
I resolved at least one test case failure on ARM64 by changing the code from:
to
which really should be the same. You'd think. Well it just goes to show. :-) |
More information: This is due to the compiler using different operations, as described in https://stackoverflow.com/questions/51124436/strange-issue-with-floating-point-accuracy-on-arm64. I was able to reproduce using https://godbolt.org/z/sP5TMqqaY, code:
Compiling with |
Different processors/operating systems can produce different encoding results, due to different implementations of floating point operations.
This PR confirms adds a test of the C implementation using
macos-latest
, currently macos-14-arm64.