is/2
-Term is
+Expression
Evaluates Expression as an arithmetic expression (see ref-ari-aex), and unifies the resulting number with Term.
The possible values for Expression are spelled out in detail in ref-ari-aex.
Character codes like "a"
are arithmetic expressions.
instantiation_error
type_error
domain_error
representation_error
| ?- X is 2 * 3 + 4. X = 10 | ?- Y = 32.1, X is Y * Y. Y = 3.21E+01, X = 1.03041E+03 | ?- 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 ! non-zero number expected, but 6/0 found ! goal: _3211 is 6/0
| ?- X is 16' 7fffffff + 3. ! Syntax error ! between lines 64 and 65 ! X is 0 ! <<here>> ! 7 fffffff+3 | ?- X is "a". X = 97 | ?- X is 4 * 5, Y is X * 4. X = 20, Y = 80
See example under assign/2
to see use of is/2
to peek at
random memory addresses.
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.
assign/2
, </2
, =:=/2
, =</2
,
=\=/2
, >/2
, >=/2
ref-ari