This preview shows page 1. Sign up to view the full content.
Unformatted text preview: while 1e20*(1e20*1e-20) will evaluate to 1e20. In addition, ﬂoating-point multiplication does not distribute over addition. For example, with single-precision ﬂoating point, the expression 1e20*(1e20-1e20) will evaluate to 0.0, while 1e20*1e20-1e20*1e20 will evaluate to NaN. On the other hand, ﬂoating-point multiplication satisﬁes 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 scientiﬁc 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 ﬂoating-point data types: float and double. On machines that support IEEE ﬂoating 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.
- Spring '10
- The American