- #1
Chasing_Time
- 8
- 0
Hi all, this (probably easy) problem from numerical analysis is giving me trouble. I can't seem to get started and need some poking in the right direction.
Consider the following claim: if two floating point numbers x and y with the same sign differ by a factor of at most the base B (1/B <= x/y <= B), then their difference x-y is exactly representable in the floating point system. Show that this claim is true for B = 2 but give a counter example for B > 2.
The general form of a floating point number:
[tex] x = d_0.d_1 ... d_{t-1} * 10^e [/tex]
I have tried exploring the binary case, noting that d_0 must be = 1 in base B=2:
[tex] x = (1 + \frac {d_1}{2} + ... + \frac {d_{t-1}} {2^{t-1}}) * 2^e [/tex]
[tex] y = (1 + \frac {d_1}{2} + ... + \frac {d_{t-1}} {2^{t-1}}) * 2^{e-1} = (\frac {1}{2} + \frac {d_1} {4} + ... + \frac {d_{t-1}} {2^t}) * 2^e[/tex]
[tex] x - y = (1 + \frac {d_1 - 1} {2} + ... + \frac {d_{t-1} - d_{t-2}} {2^{t-1}} - \frac {d_{t-1}} {2^t})*2^e[/tex]
Is this "exactly representable" in the floating-point system? I don't know what else to do or what to use as a counter example. Am I even on the right track? Thanks for any help.
Homework Statement
Consider the following claim: if two floating point numbers x and y with the same sign differ by a factor of at most the base B (1/B <= x/y <= B), then their difference x-y is exactly representable in the floating point system. Show that this claim is true for B = 2 but give a counter example for B > 2.
Homework Equations
The general form of a floating point number:
[tex] x = d_0.d_1 ... d_{t-1} * 10^e [/tex]
The Attempt at a Solution
I have tried exploring the binary case, noting that d_0 must be = 1 in base B=2:
[tex] x = (1 + \frac {d_1}{2} + ... + \frac {d_{t-1}} {2^{t-1}}) * 2^e [/tex]
[tex] y = (1 + \frac {d_1}{2} + ... + \frac {d_{t-1}} {2^{t-1}}) * 2^{e-1} = (\frac {1}{2} + \frac {d_1} {4} + ... + \frac {d_{t-1}} {2^t}) * 2^e[/tex]
[tex] x - y = (1 + \frac {d_1 - 1} {2} + ... + \frac {d_{t-1} - d_{t-2}} {2^{t-1}} - \frac {d_{t-1}} {2^t})*2^e[/tex]
Is this "exactly representable" in the floating-point system? I don't know what else to do or what to use as a counter example. Am I even on the right track? Thanks for any help.