The following code will generate a compile-time error:
ulong source;
float dest;
source = 1;
dest = source;
if (dest == 1F)
return 0;
else
return 1;
The conversion from source to dest (ulong to double) reinterprets the source's raw bytes as a float, resulting in the value 1.4E-45. Upon investigation, this issue is endemic to ConstantExpression and the way it converts values.
ConvertToType needs to take an object, instead of raw bytes as ulong, and have similar behavior to Convert.ChangeType. This is a relatively high-risk change.
The following code will generate a compile-time error:
The conversion from source to dest (ulong to double) reinterprets the source's raw bytes as a float, resulting in the value 1.4E-45. Upon investigation, this issue is endemic to ConstantExpression and the way it converts values.
ConvertToType needs to take an object, instead of raw bytes as ulong, and have similar behavior to Convert.ChangeType. This is a relatively high-risk change.