homework problem 248 category 1 given a oating point

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: s properties quite different from conventional integer and real arithmetic. The finite length can cause numbers to overflow, when they exceed the range of the representation. Floating point values can also underflow, when they are so close to ¼ ¼ that they are changed to zero. The finite integer arithmetic implemented by C, as well as most other programming languages, has some peculiar properties compared to true integer arithmetic. For example, the expression x*x can evaluate to a negative number due to overflow. Nonetheless, both unsigned and two’s complement arithmetic satisfies the properties of a ring. This allows compilers to do many optimizations. For example, in replacing the expression 7*x by (x<<3)-x, we make use of the associative, commutative and distributive properties, along with the relationship between shifting and multiplying by powers of two. 80 CHAPTER 2. REPRESENTING AND MANIPULATING INFORMATION Floating point representations approximate real numbers by encoding numbers of the form Ü ¢ ¾Ý . The...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online