Closed rickbrew closed 1 month ago
Now, to be fair, these two numbers do end up rounding to the same value, as evidenced by running this in the immediate window in VS:
131072.65f.ToString("N16")
"131,072.6562500000000000"
131072.66f.ToString("N16")
"131,072.6562500000000000"
But, I would still expect the generated HLSL to faithfully represent the C# code for something like this.
OR, I would expect it to emit 131072.65625
for both values
This came about while I was investigating #780 .
I don't think this issue (#779) is a high priority bug. HLSL is emitted that does not match the C# source, but it does produce the correct float value at runtime.
Instead, I consider this to be a debugging hazard: the HLSL will not match the C#, and it will be confusing.
This shader:
generates this HLSL:
Notice how the
float4
in the C# has131072.65f
but the HLSL says131072.66
.If I change to
131072.64f
then it correctly emits131072.64
.