Information Technology Reference
In-Depth Information
d. floatingpoint number: 11.01
e. floatingpoint number: 1010.101
3. Rather than using the binary system for real numbers, this
problem uses the more familiar decimal system. Throughout,
assume numbers are stored in the format described in the text
with significant digits and an exponent (power of 10). Also,
assume that a system can maintain seven decimal digits; if a
computation yields a result requiring more than seven digits,
the number will have to be rounded or truncated (your
choice, but you must be consistent).
a. Explain how the number 12,345,670 could be stored cor
rectly in this system.
b. Suppose 1 is added to 12,345,670. What is the resulting
number actually stored as? Does your answer depend on
whether the result is rounded or truncated?
c. Suppose 1000 is added to 12,345,670. Again, indicate the
resulting number stored, and comment on whether round
ing or truncation matter.
d. Suppose the number 1 is added to itself 1000 times. Indicate
the result obtained, either with rounding or truncating.
Now consider the sum
1 1 . . . 1 12,345,670
where there are 1000 1's at the start.
e. What is the result if addition proceeds from left to right
(the 1's are added first)? Does your answer depend on
whether addition uses rounding or truncation to seven sig
nificant digits?
f. What is the result if addition proceeds from right to left
(the first addition is 1 12,345,670)? Again, does your
answer depend on whether addition uses rounding or trun
cation to seven significant digits?
g. Addition is said to be associative if numbers can be added
in any order to get the same result, and much mathematics
depends on the associativity of arithmetic operations.
Using your results in this problem, can you say anything
about the associativity of addition for floatingpoint num
bers in computers? Explain briefly.
Search WWH ::




Custom Search