40 namespace Gecode {
namespace Int {
namespace Arithmetic {
47 template<
class Val,
class VA,
class VB,
class VC>
54 template<
class Val,
class VA,
class VB,
class VC>
62 template<
class Val,
class VA,
class VB,
class VC>
68 template<
class Val,
class VA,
class VB,
class VC>
79 static_cast<Val
>(x2.max())+
80 static_cast<Val>(1))));
84 x1.lq(home,f_d_p<Val>(x0.max(),x2.min())));
87 static_cast<Val
>(x2.max())+static_cast<Val>(1))));
89 return x0.assigned() && x1.assigned() ?
93 template<
class Val,
class VA,
class VB,
class VC>
100 static_cast<double>(x1.max()))));
131 if (
pos(x2) ||
pos(x0))
goto rewrite_ppp;
132 if (
neg(x2) ||
neg(x0))
goto rewrite_npn;
136 if (
neg(x2) ||
pos(x0))
goto rewrite_pnn;
137 if (
pos(x2) ||
neg(x0))
goto rewrite_nnp;
141 if (
pos(x0))
goto rewrite_ppp;
142 if (
neg(x0))
goto rewrite_nnp;
146 if (
pos(x0))
goto rewrite_pnn;
147 if (
neg(x0))
goto rewrite_npn;
150 assert(
any(x1) &&
any(x2));
152 m<double>(x1.min(),x2.min()-1)-1)));
154 m<double>(x1.max(),x2.min()-1))));
163 if (
pos(x0))
goto rewrite_ppp;
164 if (
neg(x0))
goto rewrite_nnp;
169 if (x0.assigned() && x1.assigned())
179 if (
pos(x0))
goto rewrite_ppp;
180 if (
neg(x0))
goto rewrite_npn;
185 if (x0.assigned() && x1.assigned())
195 if (
pos(x0))
goto rewrite_pnn;
196 if (
neg(x0))
goto rewrite_npn;
203 if (x0.assigned() && x1.assigned())
213 if (
pos(x0))
goto rewrite_pnn;
214 if (
neg(x0))
goto rewrite_nnp;
219 if (x0.assigned() && x1.assigned())
225 ::
post(home(*
this),x0,x1,x2)));
236 assert(x0.assigned() && x1.assigned());
238 if (x0.val()/x1.val() < 0)
249 if (
pos(x1) ||
pos(x2))
goto post_ppp;
250 if (
neg(x1) ||
neg(x2))
goto post_pnn;
251 }
else if (
neg(x0)) {
252 if (
neg(x1) ||
pos(x2))
goto post_nnp;
253 if (
pos(x1) ||
neg(x2))
goto post_npn;
254 }
else if (
pos(x1)) {
255 if (
pos(x2))
goto post_ppp;
256 if (
neg(x2))
goto post_npn;
257 }
else if (
neg(x1)) {
258 if (
pos(x2))
goto post_nnp;
259 if (
neg(x2))
goto post_pnn;
316 }
else if (x0.max() <= 0) {
318 }
else if (x2.min() > 0) {
320 }
else if (x2.max() < 0) {
332 int x2absmin =
any(x2) ? 0 : (
pos(x2) ? x2.min() : -x2.max());
335 }
while (!signIsSame &&
336 (x0.min() > 0 || x0.max() < 0 || x2.min() > 0 || x2.max() < 0));
341 int x1absmin =
any(x1) ? 0 : (
pos(x1) ? x1.min() : -x1.max());
342 if (x2max < x1absmin)