--

Math.round & Math.floor alternatives

They are valid for 32 bits numbers.

Bitwise operators convert the numbers into 32 bits integers. Which is not the case for Math.floor(). But bitwise operator are faster.

The commonly bitwise operator used as alternative to Math.floor is ~~, it is a double NOT. ~~2.5 outputs 2.

Thanks for the article!

--

--

Andrea Koutifaris
Andrea Koutifaris

No responses yet