This would be in a file tmp.pl
:-use_module(library(clpfd)).
tst(R,G,X):-
(R + G) // 2 #= X.
These queries works as I expect
?- tst(100,400,X).
X = 250.
?- tst(100,400,250).
true
Why am I getting this, I expect X to be 400
?- tst(100,X,250).
X in 400..401,
100+X#=_6404,
_6404 in 500..501.
Very possibly I don’t know enough clpfd, but how do I convert the ‘X in 400…401’ to a Prolog number? I am running a version 8.1.17.
Thanks.