Language Reference

INT Function

truncates a value

INT( matrix)

where matrix is a numeric matrix or literal.

The INT function truncates the decimal portion of the value of the argument. The integer portion of the value of the argument remains. The INT function takes the integer value of each element of the argument matrix.

An example that uses the INT function follows:

  
    c=2.8; 
    b=int(c); 
  
                 B             1 row       1 col     (numeric) 
  
                                           2
 
In the next example, notice that a value of 11 is returned. This is because of the maximal machine precision. If the difference is less than 1E-12, the INT function rounds up. Here is the code:
  
    x={12.95  10.9999999999999, 
       -30.5  1e-6}; 
    b=int(x); 
  
                 B             2 rows      2 cols    (numeric) 
  
                                     12        11 
                                    -30         0
 

Previous Page | Next Page | Top of Page