-
Notifications
You must be signed in to change notification settings - Fork 91
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
Compute values for rational magnitude powers #601
Conversation
Since this will only ever be done at compile time (as guaranteed by using `consteval`), we can afford to prioritize precision over speed. To compute an Nth root, we simply do a binary search over representable floating point numbers, looking for the number whose Nth power most closely matches the original number. Fixes mpusz#494. We have included a test case reproducing the original problem exactly. All tests use "within 4 ULPs" as the criterion, which is (I believe) equivalent to the googletest `EXPECT_DOUBLE_EQ` criterion.
"Formatting CI" fails. Please run pre-commit according to the instructions in https://github.com/mpusz/mp-units/blob/master/CONTRIBUTING.md#unified-code-formatting. |
mp-units/test/static/math_test.cpp Line 39 in f5eda4a
|
It seems that the libc++-18 issues are fixed now, and a few problems have surfaced in our code. I fixed all of them today. Please rebase to master and fix the remaining issues in your code. There are at least two more issues to be fixed: |
Apple clang does not like this linkage: It's weird, because the undefined symbol is Maybe the solution is more obvious to you. |
This was also the case for clang-16: Hopefully, now it will be OK. |
Really glad I asked for help instead of trying to solve it on my own --- I would never have come up with that! |
Yeah, I had a few issues with clang-16 already 😉 |
I had to manually restart each of 3 failed jobs. The jobs gave no reason for their failure, and all of them passed on retry. In any case, we're at a 100% pass rate right now! |
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.
Thanks @chiphogg!
Since this will only ever be done at compile time (as guaranteed by
using
consteval
), we can afford to prioritize precision over speed. Tocompute an Nth root, we simply do a binary search over representable
floating point numbers, looking for the number whose Nth power most
closely matches the original number.
Fixes #474. We have included a test case reproducing the original
problem exactly. All tests use "within 4 ULPs" as the criterion, which
is (I believe) equivalent to the googletest
EXPECT_DOUBLE_EQ
criterion.