34namespace 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 cnroot(int x) const
Return where x must be non-negative and .
int tpow(int x) const
Return where truncated to integer limits.
bool powgr(long long int r, int x) const
Test whether .
IntType pow(IntType x) const
Return where .
int exp(void) const
Return exponent.
bool powle(long long int r, int x) const
Test whether .
int n
The exponent and root index.
PowOps(int n)
Initialize with exponent n.
int fnroot(int x) const
Return where x must be non-negative and .
bool even(void) const
Return whether exponent is even.
int tpow(int x) const
Return truncated to integer limits.
int fnroot(int x) const
Return where x must be non-negative and .
bool even(void) const
Return whether exponent is even.
IntType pow(IntType x) const
Return .
int cnroot(int x) const
Return where x must be non-negative and .
int exp(void) const
Return exponent.
const int min
Smallest allowed integer value.
const int max
Largest allowed integer value.
Gecode toplevel namespace
Post propagator for SetVar SetOpType SetVar SetRelType r
Post propagator for SetVar SetOpType SetVar y
Post propagator for SetVar x
#define GECODE_NEVER
Assert that this command is never executed.