Last Updated: February 25, 2016
·
789
· roine

Math.floor quick and easy

To quickly round a float on floor, you can use bitwise operation:
~~1.5 -> 1
~~2.9 -> 2
~~1.1 -> 1
This is a double bitwise NOT, so the processing is also faster.
Here (http://jsperf.com/round-floor-perf) you can test the processing speed