Skip to content

Commit

Permalink
Merge pull request #2278 from notoria/clpz
Browse files Browse the repository at this point in the history
Small fixes for `CLP(ℤ)`
  • Loading branch information
mthom authored Jan 8, 2024
2 parents 7b8c8fd + 1f3de74 commit f9eadc8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/lib/clpz.pl
Original file line number Diff line number Diff line change
Expand Up @@ -5384,6 +5384,7 @@
; Z > X -> queue_goal(Z = Y)
; { false } % Z < X
)
; Y == Z -> kill(MState), queue_goal(Y #>= X)
; { fd_get(Y, _, YInf, YSup, _) },
( { YInf cis_gt n(X) } -> queue_goal(Z = Y)
; { YSup cis_lt n(X) } -> queue_goal(Z = X)
Expand All @@ -5398,7 +5399,7 @@
; { fd_get(Z, ZD, ZPs) } ->
{ fd_get(X, _, XInf, XSup, _),
fd_get(Y, _, YInf, YSup, _) },
( { YInf cis_gt YSup } -> kill(MState), queue_goal(Z = Y)
( { YInf cis_gt XSup } -> kill(MState), queue_goal(Z = Y)
; { YSup cis_lt XInf } -> kill(MState), queue_goal(Z = X)
; { n(M) cis max(XSup, YSup) } ->
{ domain_remove_greater_than(ZD, M, ZD1) },
Expand All @@ -5419,6 +5420,7 @@
; Z < X -> Z = Y
; { false } % Z > X
)
; Y == Z -> kill(MState), queue_goal(Y #=< X)
; { fd_get(Y, _, YInf, YSup, _) },
( { YSup cis_lt n(X) } -> Z = Y
; { YInf cis_gt n(X) } -> Z = X
Expand All @@ -5433,7 +5435,7 @@
; { fd_get(Z, ZD, ZPs) } ->
{ fd_get(X, _, XInf, XSup, _),
fd_get(Y, _, YInf, YSup, _) },
( { YSup cis_lt YInf } -> kill(MState), Z = Y
( { YSup cis_lt XInf } -> kill(MState), Z = Y
; { YInf cis_gt XSup } -> kill(MState), Z = X
; { n(M) cis min(XInf, YInf) } ->
{ domain_remove_smaller_than(ZD, M, ZD1) },
Expand Down Expand Up @@ -5540,7 +5542,7 @@
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
Expand Down

0 comments on commit f9eadc8

Please sign in to comment.