Consider the following signature in C#:
double Divide(int numerator, int denominator);
Is there a performance difference between the following implementations?
return (double)numerator / denominator; return numerator / (double)denominator; return (double)numerator / (double)denominator;
I’m assuming that both of the above return the same answer.
Have I missed any other equivalent solution?
Have you tried comparing the IL (for example, with Reflector)?
All three become (give or take the name):
So no: there is exactly zero difference.