Floating point bug?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark Dickinson

    #136
    Re: How about adding rational fraction to Python?

    On Mar 12, 7:20 am, Piet van Oostrum <p...@cs.uu.nlw rote:
    But if the answer is incorrect (in the float calculation) the error is
    limited. IEEE 754 prescribes that the error should be at most 1 LSB, IIRC.
    And then the number of errors is the proper measure.
    There are two operations here, both of which can introduce error of
    up to 0.5 ulp (ulp = unit in the last place). Moreover, the second
    operation (the multiplication) can magnify the error introduced by
    the first (the division).

    You're correct that for IEEE 754 binary floating-point arithmetic,
    (x/y)*y and x will either be equal or differ by exactly 1ulp (except
    perhaps in rarely-occurring corner cases). But for decimal numbers,
    (x/y)*y and x could be as much as 5 ulps apart.

    Mark

    --
    Piet van Oostrum <p...@cs.uu.n l>
    URL:http://pietvanoostrum.com[PGP 8DAE142BE17999C 4]
    Private email: p...@vanoostrum .org

    Comment

    Working...