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

Use float literals where applicable, fix -Wdouble-promotion #1210

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

vfjpl
Copy link
Contributor

@vfjpl vfjpl commented Aug 12, 2023

Use float literals to perform more calculation in float instead of performing implicit conversion to double and back to float.

This fixes warnings with -Wdouble-promotion

@diath
Copy link
Collaborator

diath commented Aug 13, 2023

Do we enable -Wdouble-promotion by default? Aren't most modern CPUs implementing doubles in hardware? It looks like this change is backwards because it would cater to older hardware instead?

@vfjpl
Copy link
Contributor Author

vfjpl commented Aug 13, 2023

All of this calculations was already done in floats. double literals just caused unnecessary conversion from float to double and back to float.
"It looks like this change is backwards because it would cater to older hardware instead?"
No, why is that? New hardware works with floats perfectly well. floats are plenty precise for our use.

@diath
Copy link
Collaborator

diath commented Aug 14, 2023

No, why is that? New hardware works with floats perfectly well. floats are plenty precise for our use.

You're right, not sure what I was thinking here when making that comment.

@diath diath merged commit e6861d7 into edubart:master Aug 14, 2023
10 checks passed
@vfjpl vfjpl deleted the float branch August 25, 2024 00:29
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