triska / clpz

Constraint Logic Programming over Integers
https://www.metalevel.at/prolog/clpz
184 stars 15 forks source link

sign/1 lacking #17

Open UWN opened 2 years ago

UWN commented 2 years ago
?- X #= sign(-10).
caught: error(domain_error(clpz_expression,sign(-10)),unknown(sign(-10))-1)

Expected: X = -1.

See also this comment.

UWN commented 2 years ago
?- X #= sign(X).
   clpz:(X#=sign(X)), clpz:(X in-1..1). % clpz:(X#=sign(X)) not needed

Whenever X is -1..1 or less, replace sign(X) by X.

UWN commented 1 year ago

@triska: Is this too difficult to integrate?


?- X #= sign(X).
   clpz:(X#=sign(X)), clpz:(X in-1..1), unexpected.
   clpz:(X in-1..1). % expected
   X in-1..1. % alternate formulation