Working with integers

UH!? WHERE'S MY HUG!?
Oh I like to round numbers using the double complement method really:

var rounded = ~~num;This is limited to 2^32, but for most of the time it's ok.

This doesn't work:

Number.MAX_SAFE_INTEGER === ~~Number.MAX_SAFE_INTEGERWich is sad...

Still the fatest way (and the cleaner one) is Math.floor()... So for the first time, use Math.floor() and not the parseInt() hack...

Wich is impressive, because you have to always use hacks...
Thanks a bunch guys :3

If you are working with projections. You know, the typical transformation when dealing using an affine transformation matrix, translate, rotate, scale, shear, reflect. Particularly shear and rotate can benefit from decimal values.
I'll give you that, Most of the JS I write doesn't deal with that jazz though. So its good to learn something new

Original thread: https://forums.rpgmakerweb.com/threads/working-with-integers.46200/