-
Notifications
You must be signed in to change notification settings - Fork 168
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
refactor: use mathematical constants from std::numbers
#3781
Conversation
Important Review skippedAuto reviews are limited to specific labels. 🏷️ Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Great work, went through all 202 files, which is a bit annoying that after 150 it actually needs loading diff instructions for every file.
I left a few comments more to follow=up.
Examples/Algorithms/TrackFinding/include/ActsExamples/TrackFinding/HoughTransformSeeder.hpp
Show resolved
Hide resolved
Fatras/include/ActsFatras/Physics/ElectroMagnetic/detail/GaussianMixture.hpp
Show resolved
Hide resolved
Examples/Detectors/MuonSpectrometerMockupDetector/src/MockupSectorBuilder.cpp
Outdated
Show resolved
Hide resolved
Examples/Detectors/MuonSpectrometerMockupDetector/src/MockupSectorBuilder.cpp
Outdated
Show resolved
Hide resolved
@AJPfleger some comments from my side. As a general rule though (just a tip): 100 small PRs are much better than a single giant PR. Small PRs are much easier to review (review time is very small, and I see that reviewers have the tendency to delay big PRs) and smaller chance of merge conflicts. |
Do you wanna make a |
I prepared a check: That one only checks for macros. I tried to also replace values like |
Quality Gate passedIssues Measures |
The firstly intended clang tidy check `modernize-use-std-numbers` is not suited for us: - it doesn't flag macros like `M_PI` - it flags values in our tables that get close to constants, which have a different basis. benefit would have been to detect cases like `static_cast<float>(std::numbers::pi)` instead of `std::numbers::pi_v<float>` or usages of `std::sqrt(2.)` instead of `std::numbers::sqrt2`. The updated test now checks for the classical `M_*` macros that could be accidentally used. blocked: - #3781
…t#3781) blocked: - acts-project#3783 Asked co-pilot to summarise the PR: Summary: The pull request aims to refactor the code to use mathematical constants from the C++20 <numbers> header, replacing existing instances of M_PI with std::numbers::pi. The changes span multiple files, primarily focusing on improving the consistency and modernity of mathematical constant usage across the codebase.
The firstly intended clang tidy check `modernize-use-std-numbers` is not suited for us: - it doesn't flag macros like `M_PI` - it flags values in our tables that get close to constants, which have a different basis. benefit would have been to detect cases like `static_cast<float>(std::numbers::pi)` instead of `std::numbers::pi_v<float>` or usages of `std::sqrt(2.)` instead of `std::numbers::sqrt2`. The updated test now checks for the classical `M_*` macros that could be accidentally used. blocked: - acts-project#3781
blocked:
Asked co-pilot to summarise the PR:
Summary:
The pull request aims to refactor the code to use mathematical constants from the C++20 header, replacing existing instances of M_PI with std::numbers::pi. The changes span multiple files, primarily focusing on improving the consistency and modernity of mathematical constant usage across the codebase.