| 117 | |
| 118 | template<class A, class B> |
| 119 | ExecStatus |
| 120 | Sin<A,B>::dopropagate(Space& home, A x0, B x1) { |
| 121 | GECODE_ME_CHECK(x1.eq(home,sin(x0.val()))); |
| 122 | Rounding r; |
| 123 | int n_min = 2*static_cast<int>(r.div_up(x0.min(), pi_twice_upper())); |
| 124 | int n_max = 2*static_cast<int>(r.div_up(x0.max(), pi_twice_upper())); |
| 125 | if (x0.min() < 0) n_min-=2; |
| 126 | if (x0.max() < 0) n_max-=2; |
| 127 | FloatNum iv_min = r.sub_down(x0.min(),r.mul_down(n_min, pi_upper())); |
| 128 | FloatNum iv_max = r.sub_up (x0.max(),r.mul_down(n_max, pi_upper())); |
| 129 | aSinProject(r,x1,iv_min,iv_max,n_min,n_max); |
| 130 | FloatNum n_iv_min = r.add_down(iv_min,r.mul_down(n_min, pi_upper())); |
| 131 | FloatNum n_iv_max = r.add_up (iv_max,r.mul_down(n_max, pi_upper())); |
| 132 | if (n_iv_min > n_iv_max) return ES_FAILED; |
| 133 | GECODE_ME_CHECK(x0.eq(home,FloatVal(n_iv_min,n_iv_max))); |
| 134 | GECODE_ME_CHECK(x1.eq(home,sin(x0.val()))); // Redo sin because with x0 reduction, sin may be more accurate |
| 135 | return ES_OK; |
| 136 | } |
| 137 | |
| 138 | template<class A, class B> |
| 139 | forceinline |
nothing calls this directly
no test coverage detected