is/2 [ISO]-Term is +Expression
Evaluates Expression as an arithmetic expression, and unifies the resulting number with Term.
An expression made up of:
Arithmetic errors (see ref-ari-exc).
| ?- X is 2 * 3 + 4.
X = 10
| ?- Y = 32.1, X is Y * Y.
X = 1030.41
Y = 32.1
| ?- Arity is 3 * 8, X is 4 + Arity + (3 * Arity * Arity).
Arity = 24
X = 1756
| ?- X is 6/0.
! Domain error in argument 2 of is/2
! expected an integer not equal to 0, but found 0
! goal: _98 is 6/0
| ?- X is "a".
X = 97
| ?- X is 4 * 5, Y is X * 4.
X = 20,
Y = 80
If a variable in an arithmetic expression is
bound to another arithmetic expression (as opposed to a number) at
runtime then the cost of evaluating that expression is much greater.
It is approximately equal to the cost of call/1 of an arithmetic
goal.