In his blog post on 512 bit division, Remco Bloemen makes the following assertion:
... negation flips all high bits of a number up to but not including the least significant one
Why is that?
In his blog post on 512 bit division, Remco Bloemen makes the following assertion:
... negation flips all high bits of a number up to but not including the least significant one
Why is that?
This is because the EVM uses the two's complement system to store signed values.
By definition, negating a number in two's complement involves two steps:
The 1 is added at the end, so the least significant bit remains unchanged (it goes back to its original value, in a roundabout way).