<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <font face="Arial">Hello all,<br>
      <br>
      I am wondering how it is possible to print (in a file, in a
      string) new 64 bit integers,<br>
      at full accuracy. Their relative accuracy is better than for
      decimal numbers<br>
      (1/2^63 instead of %eps=1/2^52).<br>
      <br>
      In Scilab 5, digits lower than 1/%eps -- that are somewhat
      randomly set --<br>
      can be displayed but are not relevant:<br>
    </font><tt>-->format(24)</tt><tt><br>
      -->%pi</tt><tt><br>
    </tt><tt> %pi  =</tt><tt><br>
    </tt><tt>    3.141592653589793115998<br>
      <br>
      -->(%pi-3.141592653589793)==0<br>
       ans  =<br>
        T  <br>
    </tt><font face="Arial"><br>
      In Scilab 6, digits beyond %eps are displayed as 0. This is great:<br>
    </font><tt>--> format(24)</tt><tt><br>
    </tt><tt>--> %pi</tt><tt><br>
    </tt><tt> %pi  = </tt><tt><br>
    </tt><tt>   3.141592653589793100000</tt><tt><br>
    </tt><font face="Arial"><br>
      However, this change is applied to all numbers, even to integers.<br>
      The issue is that Scilab 6 also brings super-integers :) int64 /
      uint64<br>
      having 64-bit mantissae, instead of 53-bit mantissae for decimal
      numbers.<br>
      Hence, int64 have a relative accuracy better than %eps.<br>
      Unfortunately the related digits can't be printed.<br>
      Only the default display in console works.<br>
      Examples:<br>
    </font><tt>i = int64(2)^62 + 1</tt><tt><br>
    </tt><tt>printf("%d  %i  %ld  %li \n", i, i ,i, i)</tt><tt><br>
    </tt><tt>format(22)</tt><tt><br>
    </tt><tt>string(i)</tt><tt><br>
    </tt><tt>// I found this undocumented trick with printf format, but
      there is the same truncature:</tt><tt><br>
    </tt><tt>printf("%20.0f\n", i)</tt><tt><br>
    </tt><font face="Arial"><br>
      // Results:<br>
    </font><tt>--> i = int64(2)^62 + 1</tt><tt><br>
    </tt><tt> i  = </tt><tt><br>
    </tt><tt>  4611686018427387905</tt><tt>        // The right value!<br>
    </tt><tt></tt><tt><br>
    </tt><tt>--> printf("%d  %i  %ld  %li \n", i, i ,i, i)</tt><tt><br>
    </tt><tt>-2147483648  -2147483648  -2147483648  -2147483648    //
      Oups</tt><tt>. %lld does nor work<br>
    </tt><tt><br>
    </tt><tt>--> format(22)</tt><tt><br>
    </tt><tt>--> string(i)</tt><tt><br>
    </tt><tt> ans  =</tt><tt><br>
    </tt><tt> 4611686018427387900        // bad trailing zeros</tt><tt><br>
    </tt><tt><br>
    </tt><tt>--> // I found this undocumented trick with printf
      format, but there is the same truncature:</tt><tt><br>
    </tt><tt>--> printf("%20.0f\n", i)</tt><tt><br>
    </tt><tt> 4611686018427387900        // Same issue (final 5 missing)<br>
      <br>
    </tt><tt></tt><tt><br>
    </tt>I started looking for a solution with write() and its fortran
    formating,<br>
    but it looks no more ready for int64 integers.<br>
    <br>
    Would you know any solution?<br>
    <font face="Arial"><font face="Arial"><font face="Arial"><font
            face="Arial"><br>
            Thanks<br>
            Samuel<br>
            <br>
          </font></font>
      </font></font>
  </body>
</html>