2 ms·
Math.floor is the right choice 99% of the time for three reasons: 1. it will always behave correctly (barring implementation bugs) 2. readable/mantaina
by ricardobeat 14y ago
Math.floor is the right choice 99% of the time for three reasons:
1. it will always behave correctly (barring implementation bugs)
2. readable/mantainable code comes first
3. leave tricks to the interpreter
4. you're not gonna do 60 million flooring ops/s
5. -1.1 is really -2+.9
The author missed the ~~1.1 trick (essentially the same as << 0).