Does casting double
to float
always produce same result, or can there be some "rounding differences"?
For example, is x
in
float x = (float)0.123456789d;
always the same value?
What about when casting float to double, and then casting it back to float ie. (float)(double)someFloat
?
Mostly interested in what the results are in C#, but feel free to share if you have knowledge about how this works on other languages.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…