Yes, this is a shortcoming of half not offering conversion constructors for
every possible builtin type, but only for float. So when converting a
double to a half, it always takes the route over the implicit conversion to
float first. This is somewhat intentional, but can cause some unwanted
warnings. The only way around that is either using the explicit 'half_cast'
or explicitly converting the double to float beforehand. But I'm
reconsidering the layout of conversion constructors and assignment
operators.
Hi, I have
warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data
~~~
double a = 1.0;
half b = 2.0_h;
b = (half)a;
~~~
internally half.hpp not using double->half conversation code for some reason.
I wrote here because it is not allowed to create ticket.
Last edit: Leviathan 2020-07-10
Hello,
Yes, this is a shortcoming of half not offering conversion constructors for
every possible builtin type, but only for float. So when converting a
double to a half, it always takes the route over the implicit conversion to
float first. This is somewhat intentional, but can cause some unwanted
warnings. The only way around that is either using the explicit 'half_cast'
or explicitly converting the double to float beforehand. But I'm
reconsidering the layout of conversion constructors and assignment
operators.
Regards,
Christian Rau
Am Mo., 6. Juli 2020 um 14:13 Uhr schrieb Leviathan inferno2k@users.sourceforge.net: