What every one else said. is/2
evaluates the right-hand side as an arithmetic expression and unifies the result of that evaluation (assuming that it was, in fact, a valid arithmetic expression, with the left hand side. So you can say things like:
X is 3+2 * 4 mod 3
0 is 3+2-5
And it's not really intended for arithmetic comparisons. But that would be clear if you had read the documentation for is/2
:
-Number is +Expr
True when Number
is the value to which Expr
evaluates.
Typically, is/2
should be used with unbound left operand.
If equality is to be tested, =:=/2
should be used. For example:
?- 1 is sin(pi/2).
Fails! sin(pi/2)
evaluates to the float 1.0
,
which does not unify with the integer 1
.
?- 1 =:= sin(pi/2).
Succeeds as expected.
And if you chase down the docs for =:=/2
and its relatives, you discover
+Expr1 > +Expr2
.
True if expression Expr1
evaluates to a larger number than Expr2
.
+Expr1 < +Expr2
.
True if expression Expr1
evaluates to a smaller number than Expr2
.
+Expr1 =< +Expr2
.
True if expression Expr1
evaluates to a smaller or equal number to Expr2
.
+Expr1 >= +Expr2
.
True if expression Expr1
evaluates to a larger or equal number to Expr2
.
+Expr1 =\= +Expr2
.
True if expression Expr1
evaluates to a number non-equal to Expr2
.
+Expr1 =:= +Expr2
.
True if expression Expr1
evaluates to a number equal to Expr2
.
A little curiousity won't hurt you.