The division in JavaScript is not integer division, but floating point.
2.3 or 2.4 can't be exactly represented in floating points. The difference is that the closest fp for 2.4 is 2.4000000953, while 2.3 is about 2.2999999523.
One can use Math.round(x)
or one can use a JavaScript trick:
(x|0) converts x to integer, as the '|' operator forces the operands to integers.
Even in this case 299.9943 is not rounded but truncated.