| 44 | |
| 45 | template<class A, class B> |
| 46 | ExecStatus |
| 47 | Abs<A,B>::post(Home home, A x0, B x1) { |
| 48 | GECODE_ME_CHECK(x1.eq(home,abs(x0.val()))); |
| 49 | if (x0.min() >= 0) |
| 50 | GECODE_ME_CHECK(x0.eq(home,FloatVal(x1.min(), x1.max()))); |
| 51 | else if (x0.max() <= 0) |
| 52 | GECODE_ME_CHECK(x0.eq(home,FloatVal(-x1.max(), -x1.min()))); |
| 53 | else |
| 54 | GECODE_ME_CHECK(x0.eq(home,FloatVal(-x1.max(), x1.max()))); |
| 55 | (void) new (home) Abs<A,B>(home,x0,x1); |
| 56 | return ES_OK; |
| 57 | } |
| 58 | |
| 59 | template<class A, class B> |
| 60 | forceinline |