1

The documentation says:

The unary ~ (invert) operator yields the bitwise inversion of its plain or long integer argument.

I'm understanding this as: "the invert operator should invert each bit." So 8 in binary is 1000, so to me ~8 should be 0111 or 7, but instead ~8 is -9. So how in the world is the inversion of 1000 -9?

John Kugelman
  • 330,190
  • 66
  • 504
  • 555
tayler6000
  • 103
  • 1
  • 8

0 Answers0