Hacker News new | past | comments | ask | show | jobs | submit login

> 2. Crucial observation: -x == ~x + 1

To be annoyingly pedantic, this is not simply an observation, this is essentially the definition of 2's complement arithmetic.




Some people do see it that way, and I think it's fine if you do, but I think I disagree. To me, the definition of N-bit two's complement is that -x (i.e. 0 - x) is represented by 2^N - x. The fact that that is equal to ~x + 1 is not obvious, or (as I see it) part of the definition.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: