]> Repositorios git - scryer-prolog.git/commitdiff
Fix bound computation in `(^)/2`
authornotoria <[email protected]>
Sun, 7 Jan 2024 19:19:40 +0000 (20:19 +0100)
committernotoria <[email protected]>
Sun, 7 Jan 2024 19:19:40 +0000 (20:19 +0100)
?- A in 0..1, B in-1..0, A^2 #= B.
   false. % unexpected.
?- A^2 #= B, A in 0..1, B in-1..0.
   A = 0, B = 0.

src/lib/clpz.pl

index d699cad18f992458cadb914fe97166bdcc3f5220..505a4f64f25e4ee4bfb84fed3957bf4a48f001a6 100644 (file)
@@ -5542,7 +5542,7 @@ run_propagator(pexp(X,Y,Z,Morph), MState) -->
                 fd_put(Z, ZD2, ZPs),
                 { (   even(Y), ZU = n(Num) ->
                     integer_kth_root_leq(Num, Y, RU),
-                    (   XL cis_geq n(0), ZL = n(Num1) ->
+                    (   XL cis_geq n(0), ZL = n(Num1), Num1 >= 0 ->
                         integer_kth_root_leq(Num1, Y, RL0),
                         (   RL0^Y < Num1 -> RL is RL0 + 1
                         ;   RL = RL0