This preview shows page 1. Sign up to view the full content.
Unformatted text preview: consequence of the convention for handling in nity.
Exercise 20 What are the values of the expressions ;1=(;0)? 0=(;0), 1=(;1) and Exercise 21 What is the result of the parallel resistance formula if an input value is negative, ;0, or NaN? Another perhaps unexpected consequence of these conventions concerns
arithmetic comparisons. When a and b are real numbers, one of three conditions holds: a = b, a < b or a > b. The same is true if a and b are oating
point numbers in the conventional sense, even if the values 1 are permitted.
However, if either a or b has a NaN value, none of the three conditions can
be said to hold (even if both a and b have NaN values). Instead, a and b are
said to be unordered. Consequently, although the logical expressions ha bi
24 and hnot(a > b)i usually have the same value, they have di erent values (the
rst false, the second true) if either a or b is a NaN.
Let us now turn our attention to over ow and under ow. Over ow is
said to occur when the true result of an arithmetic operation is nite but
larger in magnitude than the largest oating point number which can be
stored using the given precision. As with division by zero...
View Full Document
- Spring '09