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
  • 349,597
  • 67
  • 533
  • 578
tayler6000
  • 103
  • 1
  • 8

0 Answers0