Contents Previous Next Subchapters

Conversion To Integer
Syntax int(value)
See Also fix , char , real , coercion

Description
Returns the element-by-element conversion of value to an integer.

Example
If value is real or double-precision, the int function will truncate value. For example, if you enter
     int(1.9)
returns
     1
Entering
     int(-1.9)
returns
     -1
If value is complex, int will return only the integer value of the real part. If you type
     int(1.5r0 + 2.1i0)
O-Matrix will return
     1
If value is a character matrix, int will return the ASCII value of each element of value.
     int("abc")
returns
     [ 97 , 98 , 99 ]
If value is a logical matrix, int will return 1 for each true element and 0 for each false element. If you enter
     int(2 + 3 == 5)
O-Matrix will respond
     1

Mlmode
In Mlmode this function is called fix instead of int. If in Mlmode you enter
     fix(-1.9)
O-Matrix will respond
     -1