<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Houps, my bad, julia does exactly the same when using Float64,
      not Int64:</p>
    <p><br>
    </p>
    <p>println((2.0^53 + 2.0^2) + 1.0 == (2.0^53 + 2.0^2))</p>
    <p>true</p>
    <p>println((2.0^53 + 2.0^1) + 1.0 == (2.0^53 + 2.0^1))</p>
    <p>false</p>
    <p><br>
    </p>
    <p>It has to be some normal IEEE thing but I did not manage to find
      the proper reference for it.</p>
    <p><br>
    </p>
    <p>Antoine</p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">Le 18/09/2017 à 20:54, Samuel Gougeon a
      écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:03a6b389-083a-0dad-b6ab-b8a9a29ecf44@free.fr">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <p><font face="Arial">Dear co-Scilabers,</font></p>
      <p>I met a strange Scilab's bug this week-end. But today, i tried
        with Octave, Matlab2016 and R, and i found the same strange
        behavior. So, either i am missing something, or the bug affects
        all these languages in the same way. It is reported @ <a
          class="moz-txt-link-freetext"
          href="http://bugzilla.scilab.org/15276" moz-do-not-send="true">http://bugzilla.scilab.org/15276</a><br>
      </p>
      <p>In a few words, here it is:</p>
      <p>The mantissa of any decimal number is recorded on 53 bits
        (numbered #0 to #52) + 1 bit for the sign.<br>
        This relative absolute accuracy sets the value of the
        epsilon-machine :<br>
        <tt>--> %eps == 2^0 / 2^52</tt><tt><br>
        </tt><tt> ans  =</tt><tt><br>
        </tt><tt>  T</tt><br>
        From here, it comes, as expected:</p>
      <p><tt>--> 2^52 + 1 == 2^52</tt><tt><br>
        </tt><tt> ans  =</tt><tt><br>
        </tt><tt>  F</tt><tt><br>
        </tt><tt><br>
        </tt><tt>--> 2^53 - 1 == 2^53<br>
           ans  =<br>
            F<br>
          <br>
          --> 2^53 + 1 == 2^53</tt><tt>   // (A)<br>
        </tt><tt> ans  =</tt><tt><br>
        </tt><tt>  T</tt><tt><br>
        </tt><br>
        Now comes the issue:<br>
        In (A), the relative difference 1/2^53 is too small (< %eps)
        to be recorded and to change the number. OK.<br>
        Since 1 / (2^53 +2) is even smaller than 1 / (2^53), it should
        nor make a difference. Yet, it does:</p>
      <p><tt>--> (2^53 + 2^1) + 1 == (2^53 + 2^1)</tt><tt><br>
        </tt><tt> ans  =</tt><tt><br>
        </tt><tt>  F</tt><tt><br>
        </tt><br>
        How is this possible ??!<br>
        But this occurs only when THIS bit #0 is set. For higher bits
        (hebelow the #1 one), we get back to the expected behavior:<br>
        <tt>--> (2^53 + 2^2) + 1 == (2^53 + 2^2)</tt><tt><br>
        </tt><tt> ans  =</tt><tt><br>
        </tt><tt>  T</tt><tt><br>
        </tt><br>
        So, when the bit #0 is set and we add a value on the bit "#-1",
        the language somewhat behaves as if there was a "withholding"
        value on the bit #0, and seems to toogle it.<br>
        Is is a part of any IEEE floating point convention, or am i
        missing anything, or is it a true bug?<br>
        Again, R, Octave and Matlab behave exactly in the same way...</p>
      <span id="result_box" class="short_text" lang="en"><span class="">Looking
          forward to reading your thoughts,<br>
          <br>
        </span></span>Samuel<br>
      <br>
      <p><br>
      </p>
      <p><br>
      </p>
      <p><br>
      </p>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>