Closed dirkmueller closed 4 years ago
Looks good to me.
@dirkmueller
Do you have a particular platform in mind where this promoting happens?
(As I have quite some libraries this is interesting for me)
From a contributor: "it gets promoted because your literals are doubles so that widens the expression value. It's the C++ compiler doing it."
The result of these calculations is stored in float, which in the case of 32bit wide floats has 5 digits of accuracy. this is enough for the purpose. Without this change, the calculations are performed promoted and performed in double precision, which is very inefficient on some platforms that do not have support for hardware based double floating point.