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

refactor: use mathematical constants from std::numbers #3781

Merged
merged 23 commits into from
Nov 10, 2024

Conversation

AJPfleger
Copy link
Contributor

@AJPfleger AJPfleger commented Oct 24, 2024

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.

@AJPfleger AJPfleger added the 🚧 WIP Work-in-progress label Oct 24, 2024
@AJPfleger AJPfleger added this to the next milestone Oct 24, 2024
@AJPfleger AJPfleger added the 🛑 blocked This item is blocked by another item label Oct 24, 2024
@AJPfleger AJPfleger removed the 🚧 WIP Work-in-progress label Oct 25, 2024
Copy link

github-actions bot commented Oct 25, 2024

📊: Physics performance monitoring for 8ebcc81

Full contents

physmon summary

@AJPfleger AJPfleger removed the 🛑 blocked This item is blocked by another item label Oct 27, 2024
@AJPfleger AJPfleger marked this pull request as ready for review October 27, 2024 12:40
@AJPfleger AJPfleger requested a review from CarloVarni October 27, 2024 12:41
@CarloVarni
Copy link
Collaborator

CarloVarni commented Nov 5, 2024

@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.

@asalzburger
Copy link
Contributor

Do you wanna make a lint check for this?

@AJPfleger
Copy link
Contributor Author

Do you wanna make a lint check for this?

I prepared a check:

That one only checks for macros. I tried to also replace values like 3.14 but there we get from particle tables and similar false positives.

Copy link

@kodiakhq kodiakhq bot merged commit 257473a into acts-project:main Nov 10, 2024
45 checks passed
@AJPfleger AJPfleger deleted the numbers-const branch November 11, 2024 06:15
kodiakhq bot pushed a commit that referenced this pull request Nov 11, 2024
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
Rosie-Hasan pushed a commit to Rosie-Hasan/acts that referenced this pull request Nov 13, 2024
…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.
Rosie-Hasan pushed a commit to Rosie-Hasan/acts that referenced this pull request Nov 13, 2024
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
Rosie-Hasan pushed a commit to Rosie-Hasan/acts that referenced this pull request Nov 20, 2024
…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.
Rosie-Hasan pushed a commit to Rosie-Hasan/acts that referenced this pull request Nov 20, 2024
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
@paulgessinger paulgessinger modified the milestones: next, v38.0.0 Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants