An arithmetic expression is a term that is built from numbers, variables, and the arithmetic functions. An expression must be ground when it is evaluated.
- Exp1 is Exp2: The term Exp2 must be a ground expression, and Exp1 must either be a variable, or a ground expression. If Exp1 is a variable, then the call binds the variable to the result of Exp2. If Exp1 is a non-variable expression, then the call is equivalent to Exp1 =:= Exp2.
X =:= Y
:
The expression X is numerically equal to Y.
X =\= Y
:
The expression X is not numerically equal to Y.
X < Y
:
The expression X is less than Y.
X =< Y
:
The expression X is less than or equal to Y.
X > Y
:
The expression X is greater than Y.
X >= Y
:
The expression X is greater than or equal to Y.
The following functions are provided:
- X + Y: addition.
- X - Y: subtraction.
- X * Y: multiplication.
- X / Y: division.
- X // Y: integer division, the same as in C.
- X div Y: integer division, rounded down.
- X mod Y: modulo (X-integer(floor(X/Y))*Y).
- X rem Y: remainder (X-(X//Y)*Y).
- X /> Y : integer division (ceiling(X/Y)).
- X /< Y : integer division (floor(X/Y)).
- X ** Y : power.
- -X : sign reversal.
- X » Y : bit shift right.
- X « Y : bit shift left.
- X
/\
Y : bitwise and.
- X
\/
Y : bitwise or.
-
\
X : bitwise complement.
- X xor Y: bit wise xor.
- abs(X) : absolute value.
- atan(X) : arctangent(the argument is in radians).
- atan2(X,Y) : principal value of the arctangent of Y / X.
- ceiling(X) : the smallest integer that is not smaller than X.
- cos(X) : cosine (the argument is in radians).
- exp(X) : natural antilogarithm, eX.
- integer(X) : convert X to an integer.
- float(X) : convert X to a float.
- float_fractional_part(X) : float fractional part.
- float_integer_part(X) : float integer part.
- floor(X) : the largest integer that is not greater than X.
- log(X) : natural logarithm, logeX.
- log(B,X) : logarithm in the base B, logBX.
- max(X,Y) : the maximum of X and Y (not in ISO).
- max(L) : the maximum of the list of elements L (not in ISO).
- min(X,Y) : the minimum of X and Y (not in ISO).
- min(L) : the minimum of the list of elements L (not in ISO).
- pi : the constant pi (not in ISO).
- random : a random number (not in ISO).
- random(Seed) : a random number that is generated by using Seed (not in ISO).
- round(X) : the integer that is nearest to X.
- sign(X) : sign (-1 for negative, 0 for zero, and 1 for positive).
- sin(X) : sine (the argument is in radians).
- sqrt(X) : square root.
- sum(L) : the sum of the list of elements L (not in ISO).
- truncate(X) : the integer part of X.
Neng-Fa Zhou
2013-01-25