2 ms·
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 compleme
by eslaught 2y 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/Two%27s_complement
https://en.wikipedia.org/wiki/Modular_arithmetic https://en.wikipedia.org/wiki/Modular_arithmetic
- gus_massa 2y agoI agree, but I just want to add that floating point numbers use sign and magnitude representation, so the GP may be confused by that.