-
-
Notifications
You must be signed in to change notification settings - Fork 23.7k
Use float literals and real_t consistently around square values #109800
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
base: master
Are you sure you want to change the base?
Conversation
Isn't the casting done at compile time? Why using float literals even matter? |
|
@KoBeWi If you have |
f57d7e6 to
13890e2
Compare
13890e2 to
83226b5
Compare
83226b5 to
4c269de
Compare
|
|
||
| DragType resize_drag = DRAG_NONE; | ||
| real_t radius = (select_handle->get_size().width / 2) * 1.5; | ||
| const real_t radius = select_handle->get_size().width * (1.5f / 2.0f); |
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.
Adding const changes are unrelated to changes to literals, and should be in a different PR imo (I wouldn't approve them personally as I'm not altogether convinced at the idea of adding const for all const local vars, which is why I haven't approved the PR).
One is a material change which can make the assembly better, the other is a stylistic change which hasn't afaik been agreed on as a core standard.
It turns out I had previously specifically mentioned the const issue as a potential blocker in #109756 (comment) .
4c269de to
16d7e67
Compare
16d7e67 to
1fbcce0
Compare
This PR is a further subset of the changes in PR #109756, previously in PR #109738. This PR includes the changing of double literals to float literals, and using real_t consistently to avoid needless casting. I also left in some adjacent changes like adding
const, but removed all additions ofconstwhich didn't also have changes to float literals/types. This way this PR can improve those areas without unnecessary code churn (such as being changed again in a later PR).@lawnjelly mentioned here that the float literal changes are easy to approve, but the rest require more consensus.