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.4
and roundedTotal
is undefined. Evaluating PriorityJob * 100.0
at that point gives 140
. Afterwards roundedTotal = 139
.
Apparently, 140.0 is being interpreted as 139.99999. Is this a deficiency in the floating point engine? I have never seen anything like it.