38 namespace Gecode {
namespace Int {
namespace Arithmetic {
63 template<
class IntType>
94 return static_cast<int>(
p);
128 long long int m = (l +
u) >> 1;
129 if (
powgr(m,x)) u=m;
else l=m;
131 assert((
pow(l) <= x) && (x <
pow(l+1)));
132 return static_cast<int>(
l);
166 long long int m = (l +
u) >> 1;
167 if (
powle(m,x)) l=m;
else u=m;
169 assert((
pow(u-1) < x) && (x <=
pow(u)));
170 return static_cast<int>(
u);
190 template<
class IntType>
198 long long int x = _x;
203 return static_cast<int>(x*
x);
216 long long int m = (l +
u) >> 1;
217 if (m*m > x) u=m;
else l=m;
219 assert((
pow(l) <= x) && (x <
pow(l+1)));
220 return static_cast<int>(
l);
233 long long int m = (l +
u) >> 1;
234 if (m*m < x) l=m;
else u=m;
236 assert((
pow(u-1) < x) && (x <=
pow(u)));
237 return static_cast<int>(
u);
int tpow(int x) const
Return truncated to integer limits.
int tpow(int x) const
Return where truncated to integer limits.
int cnroot(int x) const
Return where x must be non-negative and .
bool powle(long long int r, int x) const
Test whether .
const int max
Largest allowed integer value.
int fnroot(int x) const
Return where x must be non-negative and .
const int min
Smallest allowed integer value.
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.
IntType pow(IntType x) const
Return where .
bool even(void) const
Return whether exponent is even.
bool even(void) const
Return whether exponent is even.
int n
The exponent and root index.
int cnroot(int x) const
Return where x must be non-negative and .
int exp(void) const
Return exponent.
union Gecode::@518::NNF::@57 u
Union depending on nodetype t.
Node * x
Pointer to corresponding Boolean expression node.
IntType pow(IntType x) const
Return .
bool powgr(long long int r, int x) const
Test whether .
int fnroot(int x) const
Return where x must be non-negative and .
Gecode toplevel namespace
IntType
Description of integer types.
#define GECODE_NEVER
Assert that this command is never executed.
int exp(void) const
Return exponent.