It removes everything after the decimal point because the bitwise operators implicitly convert their operands to signed 32-bit integers. This works whether the operands are (floating-point) numbers or strings, and the result is a number.

In other words, it yields:

function(x) { if(x < 0) return Math.ceil(x); else return Math.floor(x); }

only if x is between -(231) and 231 - 1. Otherwise, overflow will occur and the number will "wrap around".

This may be considered useful to convert a function's string argument to a number, but both because of the possibility of overflow and that it is incorrect for use with non-integers, I would not use it that way except for "code golf" (i.e. pointlessly trimming bytes off the source code of your program at the expense of readability and robustness). I would use +x or Number(x) instead.

How this is the NOT of the NOT

The number -43.2, for example is:

-43.2 10 = 11111111111111111111111111010101 2

as a signed (two's complement) 32-bit binary number. (JavaScript ignores what is after the decimal point.) Inverting the bits gives:

NOT -43 10 = 00000000000000000000000000101010 2 = 42 10

Inverting again gives:

NOT 42 10 = 11111111111111111111111111010101 2 = -43 10