Wouldn't that be parsed as a string and include all the digits? Eh, maybe not.
I actually looked into it and it correctly retains a whole bunch of the least significant binary digits, so yeah. Using this fact I'm going to hopefully be able to speed up a lot of my math code by quite a bit.
Also, I'm pretty sure this works too, instead all of the loops and stuff that you're doing:
return (%num1 + %num2) | 0;EDIT: just checked, doing
(any number) | 0 gives the full int32 version of it. This is actually a pretty big deal.
EDIT2: I did a speed check on 10,000,000 iterations of adding two 9-digit numbers. Just plain adding them together takes 142ns each, while using (a+b)|0 gives 134ns each.
Interesting.