Bitwise not

untitled script pic - 2023-07-15T172627.248
untitled script pic - 2023-07-15T172728.441

What

Snap converts the input into a 32bit signed integer

So 0 gets converted to binary 0b000000000000000000000000 (can also be represented by hexadecimal 0x00000000)

Then each bit is inverted to produce 0b11111111111111111111111111111111 or 0xFFFFFF

This is how -1 is represented using 32bits and that's why Snap! returns -1

Have a google for 32bit signed numbers to find out more about this and to learn about the two's complement encoding system

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.