ARITHMETIC EXPRESSIONS

Arithmetic is performed by built-in procedures whose arguments are integer expressions which are evaluated when the procedure is called. An integer expression is a term built from evaluable functors, integers and variables. At the time of evaluation, each variable in an integer expression must be bound to an integer, or an integer expression.

Each evaluable functor stands for an arithmetic operation. The evaluable functors are as follows, where X and Y are integer expressions:

In the arithmetic built-in procedures which follow, X and Y stand for arithmetic expressions and Z for some term.

Z is X Expression X is evaluated and the result is unified with Z.
X + Y Addition
X - Y Subtraction
X * Y Multiplication
X / Y Floating-point division
X // Y Integer division
X mod Y X modulo Y
X ** Y exponentiation (Y > 0).
X ^ Y exponentiation (Y > 0). [Not ISO Standard]
-X unary minus
abs(N) Absoliute value
acos(N) Arccosine (in radians)
asin(N) Arcsine (in radians)
atan(N) Arctangent (in radians)
atan2(Y, X) Same as atan(Y/X) except that the signs of both arguments are used to determine the quadrant of the result
ceiling(N) Smallest inteteger not smaller than N
cos(N) Cosine (argument in radians)
exp(N) Natural anitlogarithm, e^N
float(N) Convert to floating point
floor(X) Largest integer not greater than X
log(N) Natural logarithm
log10(N) Logarithm (base 10)
sin(N) Sine (argument in radians)
sign(N) Sign (-1, 0 or 1 for negative, zero or positive N)
sqrt(N) Square root
truncate(X) Integer equal to the integer part of X
X =:= Y The values of X and Y are equal.
X =\= Y The values of X and Y are not equal.
X < Y The value of X is less than the value of Y.
X > Y The value of X is greater than the value of Y.
X =< Y The value of X is less than or equal to the value of Y.
X <= Y The value of X is less than or equal to the value of Y. [Not ISO Standard]
X >= Y The value of X is greater than or equal to the value of Y.