| 416 | } |
| 417 | |
| 418 | void |
| 419 | nroot(Home home, IntVar x0, int n, IntVar x1, IntPropLevel ipl) { |
| 420 | using namespace Int; |
| 421 | Limits::positive(n,"Int::nroot"); |
| 422 | GECODE_POST; |
| 423 | if (n == 2) { |
| 424 | sqrt(home, x0, x1, ipl); |
| 425 | return; |
| 426 | } |
| 427 | Arithmetic::PowOps ops(n); |
| 428 | if (vbd(ipl) == IPL_DOM) { |
| 429 | GECODE_ES_FAIL(Arithmetic::NrootDom<Arithmetic::PowOps> |
| 430 | ::post(home,x0,x1,ops)); |
| 431 | } else { |
| 432 | GECODE_ES_FAIL(Arithmetic::NrootBnd<Arithmetic::PowOps> |
| 433 | ::post(home,x0,x1,ops)); |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | } |
| 438 |