Top
Back: int expressions
Forward: int related functions
FastBack: ideal
FastForward: intmat
Up: int
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

4.5.3 int operations

++
changes its operand to its successor, is itself no int expression
--
changes its operand to its predecessor, is itself no int expression
+
addition
-
negation or subtraction
*
multiplication
div
integer division (omitting the remainder), rounding toward 0
%, mod
integer modulo (the remainder of the division
^, **
exponentiation (exponent must be non-negative)
<, >, <=, >=, ==, <>
comparators

Note: An assignment j=i++; or j=i--; is not allowed, in particular it does not change the value of j, see Limitations.


Example:
 
  int i=1;
  int j;
  i++; i;  i--; i;
==> 2
==> 1
  // ++ and -- do not return a value as in C, cannot assign
  j = i++;
==> // ** right side is not a datum, assignment ignored
  // the value of j is unchanged
  j; i;
==> 0
==> 2
  i+2, 2-i, 5^2;
==> 4 0 25
  5 div 2, 8%3;
==> 2 2
  -5 div 2, -5 mod 2, -5 % 2;
==> -2 -1 -1
  1<2, 2<=2;
==> 1 1


Top Back: int expressions Forward: int related functions FastBack: ideal FastForward: intmat Up: int Top: Singular Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 4-0-3, 2016, generated by texi2html.