int i1 = 0, i2 = 0;
float f = 2.8f;
i1 += f;
i2 += (int)f;
f += 0.1;
i1 += f;
i2 += (int)f;
f += 0.1;
i1 += f;
i2 += (int)f;
printf("%d %d\n", i1, i2);
Output:
7 6
- Why would implicit and explicit conversion results be different?
- I would like results to be like the ones for implicit conversion, but without compilation warning. Is it possible?
Platform is Windows7, VS2010 or 2013.