In C# I can convert doubles to floats by a cast (float)
or by Convert.ToSingle()
.
double x = 3.141592653589793238463;
float a = (float)x;
float b = Convert.ToSingle(x);
a
and b
become equal.
Are there any differences between both techniques? Which one should I prefer and why?