What bitwise operation can make positive numbers negative, and vice versa?

What bitwise operation can make positive numbers negative, and vice versa?



~ the NOT operator.

~5 -> -6
0101 -> 1010 = -8 + 2

This is the same when you involve multiple zeroes, because the leftmost Bit will be a negative number.

0000 0101 -> 1111 1010 = -128 + 64 + 32 + 16 + 8 + 2 = -128 + 122 = -6

Popular posts from this blog

After analyzing the model, your manager has informed that your regression model is suffering from multicollinearity. How would you check if he's true? Without losing any information, can you still build a better model?

Is rotation necessary in PCA? If yes, Why? What will happen if you don't rotate the components?

What does Latency mean?