- Bit-wise not operator return value of one's complement. Let's take an example:

val = 9 # 1001

~val # -(1001 + 1)

- The first step is to recall the rules for binary addition.
- The rules for binary addition are a bit different than for decimal addition, which is the addition we're familiar with.
- Binary addition only has three rules:

- 0 + 0 = 0
- 0 + 1 = 1 or 1 + 0 = 1
- 1 + 1 = 10

## Comments

0 comments

Article is closed for comments.