Delete Comment

You can delete your comment:

Document:
can't do simple division with / operator
Heading:
Re: can't do simple division with / operator
Text:
Hi,

Yes the following is correct ISO conforming behaviour:
<code>
?- 3 is 6/2.
No
</code>
The reason is simple, (/)/2 returns always a float value(*), and the present case it gives 3.0. But during term unification float values are different from integer values, here 3.

You can instead do the following and use another ISO predicate:
<code>
?- 3 =:= 6/2.
Yes
</code>
The predicate (=:=)/2, in contrast to term unification, is able to compare integers and floats, and should be used in number comparison.

Bye

(*) SWI-Prolog returns integer when it can so, but this
is not required by the ISO core standard.