13 Computational Cost of Arithmetic

13 Computational Cost of Arithmetic - 13 - The...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
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 100010101 + 111111 _________________ 101010100 Subtraction, in most computers is the same as addition. In other words, x-y=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
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/12/2011 for the course E 7 taught by Professor Patzek during the Spring '08 term at University of California, Berkeley.

Page1 / 3

13 Computational Cost of Arithmetic - 13 - The...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online