Bitwise operators don't work on big integer arithmetic

untitled script pic - 2026-08-08T234109.687
Always returns -1, but I would expect it to wrap around

It’s a limitation not a bug :slight_smile:

The bit operators are just for numbers represented by 32 bits (using 2’s complement)

The bitwise operators are in JS. Blame it on the JS bitwise operators. The developers took the easy way out with that instead of implementing it in Snap! :)

Its not a case of “easy way out” :slight_smile:

If you choose to uses a 2s complement system - you have to predecide on the number of bits to use.

That’s not the problem –
I would expect it to overflow into negative number for n > 2147483647, but it instead gets coerced into JS Infinity