MCPcopy Create free account
hub / github.com/Gecode/gecode / dopropagate

Method dopropagate

gecode/float/trigonometric/sincos.hpp:119–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 15

aSinProjectFunction · 0.85
FloatValClass · 0.85
pi_halfFunction · 0.85
sinFunction · 0.50
pi_twice_upperFunction · 0.50
pi_upperFunction · 0.50
cosFunction · 0.50
eqMethod · 0.45
valMethod · 0.45
div_upMethod · 0.45
minMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected