There seems to be some kind of obscure rounding error when I run the following code:
int roundedTotal = (int)(PriorityJob * 100.0);
Initially PriorityJob = 1.4and roundedTotal- undefined. Assessment PriorityJob * 100.0at this point gives 140. Then roundedTotal = 139.
Apparently, 140.0 is interpreted as 139.99999. Is this a flaw in the floating point engine? I have never seen anything like it.
source
share