Why prefer two's complement over sign-and-magnitude for signed numbers?
Why prefer twoās complement over sign-and-magnitude for signedĀ numbers?
Itās done so that addition doesnāt need to have any special logic for dealing with negative numbers. Check outĀ the article on Wikipedia. Say you have two numbers, 2 and -1. In your āintuitiveā way of representing numbers, they would beĀ 0010Ā andĀ 1001, respectively (Iām sticking to 4 bits for size). In theĀ twoās complementĀ way, they areĀ 0010Ā andĀ 1111. Now, letās say I want to add them. Twoāsā¦
View On WordPress














