Arithmetic and Logic Functions

INT add(INT, INT, ...);

addition - two to 32 arguments

INT sub(INT, INT);

subtraction

INT mul(INT, INT, ...);

multiplication - two to 32 arguments

INT div(INT, INT);

division

INT mod(INT, INT);

modulus (remainder)

INT exp(INT, INT);

exponentiation

INT neg(INT);

integer negation

VOID incr(INT_V);

increment variable by one

VOID decr(INT_V);

decrement variable by one

BOOL and(BOOL, BOOL, ...);

logical and - two to 32 arguments

BOOL or(BOOL, BOOL, ...);

logical or - two to 32 arguments

BOOL not(BOOL);

logical not

BOOL eq(ANY, ANY);

equality (not strings)

BOOL ne(ANY, ANY);

non-equality

BOOL lt(ANY, ANY);

less than

BOOL gt(ANY, ANY);

greater than

BOOL le(ANY, ANY);

less than or equal

BOOL ge(ANY, ANY);

greater than or equal

Add, sub, mul and div do integer arithmetic. Functions add and mul can have two to 32 arguments; the sum or product of the full set of arguments is computed. Functions sub and div have two arguments each; sub subtracts its second argument from its first, and div divides its first argument by its second. The mod function returns the remainder after dividing the first parameter by the second. If the second argument to div or mod is zero, these functions return 0 and generate a run time error. Exp performs integer exponentiation. Neg negates its argument.

Incr and decr increment by one and decrement by one, respectively, the value of a variable. The argument to both functions must be a variable.

And and or do logical operations. Both functions take two to 32 arguments. All arguments are and’ed or or’ed together, respectively. The arguments are evaluated from left to right, but only up to the point where the final value of the function becomes known. Not does the logical not operation.

Eq, ne, lt, le, gt and ge evaluate the six ordering relationships between two integers.