| 397 | } |
| 398 | |
| 399 | void |
| 400 | pow(Home home, IntVar x0, int n, IntVar x1, IntPropLevel ipl) { |
| 401 | using namespace Int; |
| 402 | Limits::nonnegative(n,"Int::pow"); |
| 403 | GECODE_POST; |
| 404 | if (n == 2) { |
| 405 | sqr(home, x0, x1, ipl); |
| 406 | return; |
| 407 | } |
| 408 | Arithmetic::PowOps ops(n); |
| 409 | if (vbd(ipl) == IPL_DOM) { |
| 410 | GECODE_ES_FAIL(Arithmetic::PowDom<Arithmetic::PowOps> |
| 411 | ::post(home,x0,x1,ops)); |
| 412 | } else { |
| 413 | GECODE_ES_FAIL(Arithmetic::PowBnd<Arithmetic::PowOps> |
| 414 | ::post(home,x0,x1,ops)); |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | void |
| 419 | nroot(Home home, IntVar x0, int n, IntVar x1, IntPropLevel ipl) { |