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

Replace hardcoded maths constants with named ones #35613

Merged
merged 1 commit into from
Nov 20, 2019

Conversation

jbytheway
Copy link
Contributor

@jbytheway jbytheway commented Nov 20, 2019

Summary

SUMMARY: None

Purpose of change

For code clarity and consistency.

Describe the solution

Two places in the code using 1.41 now use M_SQRT2 instead.

One comment using 3.14 now says pi.

Describe alternatives you've considered

One of these constants is changing from float to double as a result of this change, but I think the compiler should figure it out and be no slower.

I considered writing π instead of pi.

Testing

Unit tests.

Two places in the code using 1.41 now use M_SQRT2 instead.

One comment using 3.14 now says 'pi'.
@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style labels Nov 20, 2019
@ZhilkinSerg ZhilkinSerg merged commit 2e7ae54 into CleverRaven:master Nov 20, 2019
@jbytheway jbytheway deleted the math_constants branch November 21, 2019 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants