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
640 stars 402 forks source link

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

Closed vfjpl closed 11 months ago

vfjpl commented 11 months 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 11 months 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 11 months 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 11 months 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.