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

Add PI Radians Unit #7426

Closed
wants to merge 2 commits into from
Closed

Add PI Radians Unit #7426

wants to merge 2 commits into from

Conversation

Advay17
Copy link
Contributor

@Advay17 Advay17 commented Nov 23, 2024

Useful for reducing the number of imports necessary in files, and is cleaner than using std::numbers::pi every time in C++.

@Advay17 Advay17 requested a review from a team as a code owner November 23, 2024 03:24
Copy link
Member

@calcmogul calcmogul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sold on the utility of this. You can just do the following in your local scope to reduce typing.

using std::numbers::pi;
using units::radian_t;

radian_t{pi}

We aren't worried about the extra typing in the library itself.

Also, if you really need units of pi radians, that's just units of half turns, so you could use units::turn_t instead of making a new unit type.

@Advay17
Copy link
Contributor Author

Advay17 commented Nov 23, 2024

It's mainly just syntactic sugar similar to how the java units library has both rotations and revolutions, to simplify usage for teams if they do choose to use it

@Advay17
Copy link
Contributor Author

Advay17 commented Nov 23, 2024

/format

@calcmogul
Copy link
Member

calcmogul commented Nov 23, 2024

Again, C++ already has a unit for that: units::turn_t. We don't need a second, less obvious one.

@Advay17 Advay17 closed this Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants