-
Notifications
You must be signed in to change notification settings - Fork 176
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
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 |
|
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
…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.