Homework problem 237 category 1 you just started

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: while 1e20*(1e20*1e-20) will evaluate to 1e20. In addition, floating-point multiplication does not distribute over addition. For example, with single-precision floating point, the expression 1e20*(1e20-1e20) will evaluate to 0.0, while 1e20*1e20-1e20*1e20 will evaluate to NaN. On the other hand, floating-point multiplication satisfies the following monotonicity properties for any values of , , and other than Æ Æ : and and ¼ ¼ µ µ *f *f *f *f In addition, we are also guaranteed that *f ¼, as long as Æ Æ . As we saw earlier, none of these monotonicity properties hold for unsigned or two’s complement multiplication. This lack of associativity and distributivity is of serious concern to scientific programmers and to compiler writers. Even such a seemingly simple task as writing code to determine whether two lines intersect in three-dimensional space can be a major challenge. 2.4.6 Floating Point in C C provides two different floating-point data types: float and double. On machines that support IEEE floating point, these data types correspond to single...
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