79488839

Date: 2025-03-06 09:33:19
Score: 1.5
Natty:
Report link

Basically you are working with bits.

The ~ inverts the bits of a number

5 = 00000101
~5 = 11111010

The ~5 is -6 because of the form -(N+1):
~5 = -(5+1) = -6 = 11111010

In terms of the left-bit, if you have a left-bit that is a 0 it means that your N is a positive number or 0. If you have a 1 in the left-bit than it means that your N is a negative number.

Ex.:

5 = 00000101 // starts with a 0 -> positive
~5 (-6) = 11111010 // starts with a 1 -> negative

Reasons:
  • No code block (0.5):
  • Low reputation (1):
Posted by: Fontes