I'm running this snippet of code:
int x, y;
float val1, val2, val3;
x = 20;
y = 25;
val1 = x - 10;
val2 = y/val1;
val3 = float(val2);
val4 = float(y/(x-10));
The above outputs:
val1 = 10
val2 = 2.5
val3 = 2.5
val4 = 2
Can anyone explain to me why val3 and val4 evaluate differently? , when in fact they're both doing the same calculations?