<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <font face="Courier New">Stéphane,<br>
      <br>
    </font>
    <blockquote type="cite"
      cite="mid:f5461ea0-5168-5376-7bbb-f80c2798a663@utc.fr">
      <p>--> x=1:0.1:2<br>
         x  =<br>
        <br>
           1.   1.1   1.2   1.3   1.4   1.5   1.6   1.7000000   1.8  
        1.9   2.</p>
    </blockquote>
    <br>
    However I get this:<br>
    <br>
      > x=1:0.1:2<br>
     x  = <br>
    <br>
       1.   1.1   1.2   1.3   1.4   1.5   1.6   1.7   1.8   1.9   2.<br>
    <br>
    But it is true that x(7) - 1.7 yields 2.220D-16. Here there are two
    problems, an arithmetic one and a display one. Formatting to a
    sufficiently large number of digits the arithmetic problem (or
    limitation, probably unsurmountable, originated in the
    incompatibility of binary and decimal systems) is evident:<br>
    <br>
      > format(20)<br>
    <br>
      > x=1:0.1:2<br>
     x  = <br>
    <br>
             column 1 to 6<br>
    <br>
       1.   1.10000000000000009   1.19999999999999996  
    1.30000000000000004   1.39999999999999991   1.5<br>
    <br>
             column 7 to 11<br>
    <br>
       1.60000000000000009   1.70000000000000018   1.8  
    1.89999999999999991   2.<br>
    <br>
    <br>
    Why this triggers showing several zeros I don't understand, probably
    a bug, but it can be seen that it happens when the numeric error
    affects te 16th decimal digit.<br>
    <br>
    Regards,<br>
    <br>
    Federico Miyara<br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <blockquote type="cite"
      cite="mid:f5461ea0-5168-5376-7bbb-f80c2798a663@utc.fr"> -->
      x(7) <br>
       ans  =<br>
      <p>   1.6</p>
      <p>--> x(7)-1.6 <br>
         ans  =<br>
        <br>
           0.<br>
        <br>
        --> x(8) </p>
      <p> ans  =<br>
        <br>
           1.7000000</p>
      <p>--> x(8)-1.7 <br>
         ans  =<br>
        <br>
           2.220D-16</p>
      <p>I think that we do agree about the fact that the actual Scilab
        display<br>
      </p>
      <p>--> x=1:0.1:2<br>
         x  =<br>
        <br>
           1.   1.1   1.2   1.3   1.4   1.5   1.6   1.7  1.8   1.9   2.</p>
      <p>--> x(7) <br>
         ans  =<br>
      </p>
      <p>   1.6</p>
      <p>--> x(7)-1.6 <br>
         ans  =<br>
        <br>
           0.<br>
        <br>
        --> x(8) <br>
         ans  =<br>
        <br>
           1.7</p>
      <p>--> x(8)-1.7 <br>
         ans  =<br>
        <br>
           2.220D-16</p>
      <p>is pretty but not correct/homogeneous/honest. The display that
        is obtained with the patch (first lines of this email) is
        correct+honest but not homogeneous. A pretty + mathematically
        correct display would be:</p>
      <p> </p>
      <p>--> x=1:0.1:2<br>
         x  =<br>
        <br>
           1.0000000   1.1000000   1.2000000   1.3000000   1.4000000  
        1.0000005   1.6000000   1.7000000   1.8000000   1.9000000  
        2.0000000</p>
      <p>--> x(7) <br>
         ans  =<br>
        <br>
           1.6</p>
      <p>--> x(8) <br>
         ans  =<br>
        <br>
           1.7000000</p>
      --> x(8)-1.7 <br>
      <p>  ans  =<br>
        <br>
           2.220D-16</p>
      <p>i.e. when the matrix to display is not a scalar, add always
        trailing zeros for homogeneity, BUT when it is a scalar, add
        trailing zeros only when the actual stored value is different
        from the displayed value. <br>
      </p>
      <p>The first thing that you can see is that the default format(10)
        would be very verbose, but this is tunable. A value of 7 would
        be ok, but quite low for format("e"). <br>
      </p>
      <p>S.<br>
      </p>
      <div class="moz-cite-prefix">Le 13/09/2019 à 13:37, Stéphane
        Mottelet a écrit :<br>
      </div>
      <blockquote type="cite"
        cite="mid:32f0b55a-963d-ea1c-9256-705d669d3c4e@utc.fr">
        <meta http-equiv="Content-Type" content="text/html;
          charset=UTF-8">
        <p><br>
        </p>
        <div class="moz-cite-prefix">Le 13/09/2019 à 13:07, Samuel
          Gougeon a écrit :<br>
        </div>
        <blockquote type="cite"
          cite="mid:316628fe-a1ac-f129-0b7d-dddf68028273@free.fr">
          <meta http-equiv="Content-Type" content="text/html;
            charset=UTF-8">
          <div class="moz-cite-prefix">Le 12/09/2019 à 18:55, Stéphane
            Mottelet a écrit :<br>
          </div>
          <blockquote type="cite"
            cite="mid:5ca07ea9-bf8d-dd92-958c-6abac0ce5e1a@utc.fr">I
            prefer the display after applying <a
              class="moz-txt-link-freetext"
href="https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/codereview.scilab.org/#/c/20981/"
              moz-do-not-send="true">https://codereview.scilab.org/#/c/20981/</a>:
            <br>
            <br>
            --> x0=%pi/4;h=%eps/2 <br>
             h  = <br>
            <br>
               1.110D-16 <br>
            <br>
            --> cos(x0+%i*h) <br>
             ans  = <br>
            <br>
               0.7071068 - 7.850D-17i <br>
            <br>
            However, we could discuss if the arbitrary switch to "e"
            mode is desirable or not, but since Scilab 6.0 we have got
            used to this display mixing "v" and "e" mode... <br>
          </blockquote>
          <p><br>
          </p>
          <p>... and IMO it's very suitable. The only rule should be
            that, <b><i>for a given format's width</i></b>, <b><i>the
                more the number of significant displayed figures the
                better.</i></b> When the exponent format is used, it
            takes 4 or 5 digits (D+12, D+123). As a consequence, in v
            mode, small (absolute) values should be displayed in normal
            mode down to 4 non-significant 0 (e.g. 0.000012), and
            switched to "e" mode beyond.</p>
          <p>In v mode, forcing the display of 0.0123456  in "e" mode on
            the (bad) reason that some other huge or tiny numbers in the
            matrix are displayed in this mode, would print 1.234D-02,
            and so make invisible 2 significant figures.<br>
            I do not see any reason that would impose the display mode
            to be homogeneous over all elements of a matrix, possibly
            canceling the display of significant figures in the given
            format's width.</p>
        </blockquote>
        I agree Samuel. <br>
        <blockquote type="cite"
          cite="mid:316628fe-a1ac-f129-0b7d-dddf68028273@free.fr">
          <p>Regards</p>
          <p>Samuel</p>
          <p><br>
          </p>
          <br>
          <fieldset class="mimeAttachmentHeader"></fieldset>
          <pre class="moz-quote-pre" wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org" moz-do-not-send="true">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users" moz-do-not-send="true">https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users</a>
</pre>
        </blockquote>
        <pre class="moz-signature" cols="72">-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
<a class="moz-txt-link-freetext" href="https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/www.utc.fr/~mottelet" moz-do-not-send="true">http://www.utc.fr/~mottelet</a>
</pre>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <pre class="moz-quote-pre" wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org" moz-do-not-send="true">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users" moz-do-not-send="true">https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users</a>
</pre>
      </blockquote>
      <pre class="moz-signature" cols="72">-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
<a class="moz-txt-link-freetext" href="http://www.utc.fr/~mottelet" moz-do-not-send="true">http://www.utc.fr/~mottelet</a>
</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org" moz-do-not-send="true">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users" moz-do-not-send="true">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  <div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br /> <table style="border-top: 1px solid #D3D4DE;">
        <tr>
      <td style="width: 55px; padding-top: 18px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;" /></a></td>
                <td style="width: 470px; padding-top: 17px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Libre de virus. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a>           </td>
        </tr>
</table>
<a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body>
</html>