<html>
    <head>
      <base href="http://bugzilla.scilab.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
         <tr>
                <th>Reporter</th>
            <td>sgougeon@free.fr</td>
         </tr>
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Trouble with int64() around int64(%inf)-"
   href="http://bugzilla.scilab.org/show_bug.cgi?id=15505">15505</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Trouble with int64() around int64(%inf)-
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Scilab software
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>6.0.1
          </td>
        </tr>


        <tr>
          <th>OS</th>
          <td>All OS
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Minor
          </td>
        </tr>


        <tr>
          <th>Component</th>
          <td>Numerical Math
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>bugzilla.admin@scilab.org
          </td>
        </tr>
</table>
      <p>
        <div>
        <pre>BUG DESCRIPTION:
----------------

--> imax = int64(%inf)
 imax  = 
  9223372036854775807

--> x = 2^63-1;
--> x <= imax
 ans  =
  T

--> int64(x)
 ans  =
 -9223372036854775808   <<<< Should be imax, not wrapped, since <= imax(int64)!

It's OK for the floor:
---------------------
--> imin = int64(-%inf)
 imin  = 
 -9223372036854775808

--> x=-(2^63)
 x  = 
  -9.223D+18

--> x >= imin
 ans  =
  T

--> int64(x)
 ans  =
 -9223372036854775808     <<<< OK: not wrapped


There is some trouble with uint64() as well around uint64(%inf), but distinct => reported apart.

ERROR LOG:
----------
none. wrong behavior

HOW TO REPRODUCE THE BUG:
-------------------------
imax = int64(%inf)
x = 2^63-1;
x <= imax
int64(x)==imax   // %F == The bug

// The following is OK and should remain so:
imin = int64(-%inf)
x = -(2^63)
x >= imin
int64(x)==imin


OTHER INFORMATION:
------------------
This bug has complicated a lot the design of the unit tests
test_run compatibility_functions mtlb_int_uint</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are watching all bug changes.</li>
      </ul>
    </body>
</html>