I'm no expert in bitwise operators, but here's another way to get the whole number:
var num = ~~(a / b);
This will work properly for negative numbers as well, while Math.floor()
will round in the wrong direction.
This seems correct as well:
var num = (a / b) >> 0;