34 namespace Gecode {
namespace Int {
namespace Arithmetic {
59 template<
class IntType>
90 return static_cast<int>(
p);
124 long long int m = (l +
u) >> 1;
125 if (
powgr(m,x)) u=m;
else l=m;
127 assert((
pow(l) <= x) && (x <
pow(l+1)));
128 return static_cast<int>(
l);
162 long long int m = (l +
u) >> 1;
163 if (
powle(m,x)) l=m;
else u=m;
165 assert((
pow(u-1) < x) && (x <=
pow(u)));
166 return static_cast<int>(
u);
186 template<
class IntType>
194 long long int x = _x;
199 return static_cast<int>(x*
x);
212 long long int m = (l +
u) >> 1;
213 if (m*m > x) u=m;
else l=m;
215 assert((
pow(l) <= x) && (x <
pow(l+1)));
216 return static_cast<int>(
l);
229 long long int m = (l +
u) >> 1;
230 if (m*m < x) l=m;
else u=m;
232 assert((
pow(u-1) < x) && (x <=
pow(u)));
233 return static_cast<int>(
u);
int fnroot(int x) const
Return where x must be non-negative and .
const int max
Largest allowed integer value.
bool powgr(long long int r, int x) const
Test whether .
const int min
Smallest allowed integer value.
bool even(void) const
Return whether exponent is even.
int cnroot(int x) const
Return where x must be non-negative and .
int p
Number of positive literals for node type.
int n
Number of negative literals for node type.
PowOps(int n)
Initialize with exponent n.
bool powle(long long int r, int x) const
Test whether .
int tpow(int x) const
Return truncated to integer limits.
int n
The exponent and root index.
IntType pow(IntType x) const
Return where .
union Gecode::@593::NNF::@62 u
Union depending on nodetype t.
Post propagator for SetVar SetOpType SetVar SetRelType r
Post propagator for SetVar SetOpType SetVar y
int fnroot(int x) const
Return where x must be non-negative and .
Post propagator for SetVar x
int cnroot(int x) const
Return where x must be non-negative and .
int tpow(int x) const
Return where truncated to integer limits.
Gecode toplevel namespace
bool even(void) const
Return whether exponent is even.
IntType pow(IntType x) const
Return .
IntType
Description of integer types.
int exp(void) const
Return exponent.
#define GECODE_NEVER
Assert that this command is never executed.
int exp(void) const
Return exponent.