Code: Select all
double f; int i, k;
i = 92;
f = 360 * i/256; // convert 0..255 to 0..360
A simple change of '360' to '360.0' fixes everything - provides proper promotion of whatever is the problem - and it gives the correct result - at least according to the debugger .
I seem to remember seeing this issue in other C compilers before, but my brain is fading ...
There's probably a REASON that I'm just not aware of .. but a warning non the less .
Steve