The computer doesn’t “know”. There is a mechanical procedure to do it. It’s the same one you learned in school.
If you want to test if A > B:
Scan the bits from left to right (most significant bit to least-significant)
– If the A bit is 1 and the B bit is 0 then stop. A > B
– If the A bit is 0 and the B bit is 1 then stop. B > A
– If the A bit is equal to the B bit, then go to the next bit
If all the bits were scanned, then A = B.
This is encoded in a circuit that has inputs for the two numbers.
Latest Answers