您在這裡

Computer Arithmetic and Logic

20 三月, 2015 - 16:12

The binary addition and multiplication tables are

media/image574.png

Note that if carries are ignored, subtraction of two single-digit binary numbers yields the same bit as addition. Computers use high and low voltage values to express a bit, and an array of such voltages express numbers akin to positional notation. Logic circuits perform arithmetic operations.

Exercise 5.2.3

Add twenty-five and seven in base 2. Note the carries that might occur. Why is the result "nice"? The variables of logic indicate truth or falsehood. AB, the AND of A and B, represents a statement that both A and B must be true for the statement to be true. You use this kind of statement to tell search engines that you want to restrict hits to cases where both of the events A and B occur. AB, the OR of A and B, yields a value of truth if either is true. Note that if we represent truth by a "1" and falsehood by a "0," binary multiplication corresponds to AND and addition (ignoring carries) to XOR. XOR, the exclusive or operator, equals the union of AB and AB. The Irish mathematician George Boole discovered this equivalence in the mid-nineteenth century. It laid the foundation for what we now call Boolean algebra, which expresses as equations logical statements. More importantly, any computer using base-2 representations and arithmetic can also easily evaluate logical statements. This fact makes an integer-based computational device much more powerful than might be apparent.