1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Numerical analysis, floating-point arithmetic

  1. Feb 10, 2010 #1
    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.

    1. The problem statement, all variables and given/known data

    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.


    2. Relevant equations

    The general form of a floating point number:

    [tex] x = d_0.d_1 ... d_{t-1} * 10^e [/tex]


    3. 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.
    1. The problem statement, all variables and given/known data



    2. Relevant equations



    3. The attempt at a solution
     
  2. jcsd
  3. Feb 11, 2010 #2

    Mark44

    Staff: Mentor

    Your arithmetic is off here. Since you have set this up with x being two times y, the difference x - y better be equal to y.
    Certainly x - y is exactly representable in a base-2 floating-point system, as long as x and y are.

    I don't have any examples in mind that would serve as counterexamples, but if you work with some specific numbers in base 3 or higher bases, you might be able to come up with one. By "specific numbers" I mean that you should work with numbers like 2.0121 X 32 (base-3), rather than symbolically representing the digits with d1, d2, etc. That's where I would start.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Numerical analysis, floating-point arithmetic
  1. Numerical analysis (Replies: 1)

  2. Floating points (Replies: 0)

  3. Numerical analysis (Replies: 2)

  4. Numerical Analysis (Replies: 3)

Loading...