I’m seeing this in some code I’m working on:
num1 = (float)double.Parse(parameters[i + 1]);
num2 = (float)double.Parse(parameters[i + 2]);
Was wondering why they wouldn’t just use float.Parse instead of double.Parse and casting to a float. Is there a good reason?
Yes. Above code will raise
OverflowExceptionif parameter is big, but code expects only values with max value as float max.