projog

3.26. X=:=Y - numeric equality test.

Succeeds when the number argument X is equal to the number argument Y.

Examples

?- 1=:=1.

yes

?- 1.5=:=3.0/2.0.

yes

?- 6*6=:=9*4.

yes

?- 1=:=2.

no

?- 1+1=:=1-1.

no

?- X=1, Y=1, X=:=Y.
X = 1
Y = 1

yes

?- X=1, Y=2, X=:=Y.

no

?- 7.0=:=7.0.

yes

?- 7=:=7.0.

yes

?- 7.0=:=7.

yes

?- 7=:=7.

yes

?- 7.1=:=7.1.

yes

?- 7.0=:=7.1.

no

?- 7.1=:=7.2.

no

?- 7.2=:=7.1.

no

?- 7.1=:=7.

no

?- 7=:=7.1.

no

?- -7=:=-7.

yes

?- 7=:=-7.

no

?- -7=:=7.

no

?- 9223372036854775806 =:= 9223372036854775807.

no

?- 9223372036854775807 =:= 9223372036854775806.

no

?- 9223372036854775807 =:= 9223372036854775807.

yes

?- 9223372036854775806 =:= 9223372036854775806.

yes

?- -9223372036854775808 =:= -9223372036854775807.

no

?- -9223372036854775807 =:= -9223372036854775808.

no

?- -9223372036854775808 =:= -9223372036854775808.

yes

?- -9223372036854775807 =:= -9223372036854775807.

yes

Note that due to loss of precision when comparing decimal fractions the following queries evaluate to true:

?- 9223372036854775806 =:= 9223372036854775807.0.

yes

?- 9223372036854775806.0 =:= 9223372036854775807.

yes

?- 9223372036854775806.0 =:= 9223372036854775807.0.

yes