Originally Posted by
gmontag451
Casting the equation as a float returns the expected result, if such a solution is kosher:
Kind of. Putting it in front of the first value works for that equation, but you need to watch out. Consider this slightly modified equation:
Code:
unknown = (float)5 * 2 / 6 + 6 / 7;
5 is made a float, so 2 is promoted before the mult, then 6 is promoted before the div.
But now before the addition the other div needs to be performed before, but both the operands to the div are integers, so it's done in integer arithmetic!
That one would need to be:
Code:
unknown = (float)5 * 2 / 6 + (float)6 / 7;
And the term "immediate mode" doesn't really pertain here.