Comparison
 

There are two types of predicates for comparison. These are predicates for unification comparison and predicates for arithmetic comparison.

Unification comparison. This predicates are written in Prolog and you can see their definitions in the Standard.add file.

X=Y unify X and Y
this predicate succeeds if X and Y are unifyable and unify them.

X?=Y are X and Y unifyable
this predicate succeeds if X and Y are unifyable but don't unify them.

X\=Y not unifyable
this predicate succeeds if X and Y are not unifyable.

Arithmetic comparison. These predicates are built-in and they calculate the value of the expressions X and Y and then compare these values. With these predicates you can compare integer and float numbers. Also you can compare two strings. You cannot compare a string with a number.

> bigger than
< less than
=:= equal
>= bigger or equal to
=< less or equal to
=\= not equal

When you compare integer have in mind that when one integer is bigger than 2147483647 (two billion and something) then it is accepted as negative. This comes from the 32 bit representation of the integer.

When you compare strings then smaller will be that one which is first in the alphabetical order. One symbol is before another if it is first in the ASCII table. If one string is a beginning of another then the shorter one is smaller.

For no case comparing of strings you have two more predicates: equal and less_than. Look for them in Strings.