var startX = 501;
var finalX = 320;
var multiply = .01;
var res = finalX - startX;
var extract = multiply * res;
var toEval;
if (res > 0) {
toEval = "<=";
} else {
toEval = ">=";
}
console.log("extract= " + extract + "");
while (eval(startX + toEval + finalX)) {
startX += (-1.81);
console.log(startX + " " + extract);
}
the "problem" is in the while loop, in the thirteenth iteration happen this in console:
- 482.9 -1.81
- proof2.html:39 481.09 -1.81
- proof2.html:39 479.28 -1.81
- proof2.html:39 477.46999999999997 -1.81
- proof2.html:39 475.65999999999997 -1.81
479.28 - 1.81 = 477.47
so what is really happen in the loop?