edubart / otclient

An alternative tibia client for otserv written in C++11 and Lua, made with a modular system that uses lua scripts for ingame interface and functionality, making otclient flexible and easy to customize
Other
652 stars 399 forks source link

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

Closed vfjpl closed 1 year ago

vfjpl commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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.