For example:

is **average = (double) value / count** the same as **average = value / (double) count**?

+1 vote

In this particular instance, no. It wouldn't matter which variable you would cast in this instance because they would return the same `double`

value regardless of whether the numerator or the denominator gets casted to a `double`

. However, if you were taking the value from a function that had a fraction such as 1/3 times another variable, and you casted the variable to `double`

instead of the fraction, then it would perform an integer operation on the fraction and compute your result as `0`

.

tl;dr It doesn't matter in this instance, but be mindful of which variable you cast in more complex functions.