Hacker News new | ask | show | jobs
by eslaught 760 days ago
You're thinking about a sign and magnitude representation, which is not how integers are represented in a modern computer.

The modern version is two's complement. It still has a sign bit, but negating a number involves more than just changing the sign bit since the representation is modular.

https://en.wikipedia.org/wiki/Two%27s_complement

https://en.wikipedia.org/wiki/Modular_arithmetic

1 comments

I agree, but I just want to add that floating point numbers use sign and magnitude representation, so the GP may be confused by that.