Cost of Arithmetic  1
13  The Computational Cost of Basic
Arithmetic Operations
All computers are designed to efficiently perform the four basic arithmetic operations:
add, subtract, multiply and divide.
Addition is easy because there are only two binary digits, 0 and 1.
These are the rules:
0+0=0
0+1=1
1+0=1
1+1=0
Real numbers are added by first "aligning" the fractional parts (i.e., by equating the
exponents), and then adding the fractions together and, when necessary, updating the
exponent.
Using the rules established above, it can be easily verified that
1 0 0 0 1 0 1 0 1
+
1 1 1 1 1 1
_________________
1 0 1 0 1 0 1 0 0
Subtraction, in most computers is the same as addition.
In other words,
xy=x+(y).
The basic multiplication rules for binary integers are:
0*0=0
0*1=0
1*0=0
1*1=1
You can multiply long binary numbers together the same way you multiply numbers in
base 10 using a pen and paper. (However, there exist faster multiplication algorithms
which will not be discussed here.)
To multiply floating point numbers, you multiply the
mantissas and add the exponents.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '08
 Patzek
 Addition, Multiplication, Elementary arithmetic, floatingpoint operations, basic arithmetic operations

Click to edit the document details