Numerical limits for integer variables. More...
Functions | |
bool | valid (int n) |
Return whether n is in range. | |
bool | valid (long long int n) |
Return whether n is in range. | |
void | check (int n, const char *l) |
Check whether n is in range, otherwise throw out of limits with information l. | |
void | check (long long int n, const char *l) |
Check whether n is in range, otherwise throw out of limits with information l. | |
void | positive (int n, const char *l) |
Check whether n is in range and strictly positive, otherwise throw out of limits with information l. | |
void | positive (long long int n, const char *l) |
Check whether n is in range and strictly positive, otherwise throw out of limits with information l. | |
void | nonnegative (int n, const char *l) |
Check whether n is in range and nonnegative, otherwise throw out of limits with information l. | |
void | nonnegative (long long int n, const char *l) |
Check whether n is in integer range and nonnegative, otherwise throw out of limits exception with information l. | |
bool | overflow_add (int n, int m) |
Check whether adding n and m would overflow. | |
bool | overflow_add (long long int n, long long int m) |
Check whether adding n and m would overflow. | |
bool | overflow_sub (int n, int m) |
Check whether subtracting m from n would overflow. | |
bool | overflow_sub (long long int n, long long int m) |
Check whether subtracting m from n would overflow. | |
bool | overflow_mul (int n, int m) |
Check whether multiplying n and m would overflow. | |
bool | overflow_mul (long long int n, long long int m) |
Check whether multiplying n and m would overflow. | |
Variables | |
const int | max = INT_MAX - 1 |
Largest allowed integer value. | |
const int | min = -max |
Smallest allowed integer value. | |
const int | infinity = max + 1 |
Infinity for integers. | |
const long long int | llmax = LLONG_MAX - 1 |
Largest allowed long long integer value. | |
const long long int | llmin = -llmax |
Smallest allowed long long integer value. | |
const long long int | llinfinity = llmax + 1 |
Infinity for long long integers. | |
Numerical limits for integer variables.
The integer limits are chosen such changing the sign is always possible without overflow.
|
inline |
Return whether n is in range.
Definition at line 37 of file limits.hpp.
|
inline |
Return whether n is in range.
Definition at line 41 of file limits.hpp.
|
inline |
Check whether n is in range, otherwise throw out of limits with information l.
Definition at line 46 of file limits.hpp.
|
inline |
Check whether n is in range, otherwise throw out of limits with information l.
Definition at line 51 of file limits.hpp.
|
inline |
Check whether n is in range and strictly positive, otherwise throw out of limits with information l.
Definition at line 57 of file limits.hpp.
|
inline |
Check whether n is in range and strictly positive, otherwise throw out of limits with information l.
Definition at line 62 of file limits.hpp.
|
inline |
Check whether n is in range and nonnegative, otherwise throw out of limits with information l.
Definition at line 68 of file limits.hpp.
|
inline |
Check whether n is in integer range and nonnegative, otherwise throw out of limits exception with information l.
Definition at line 73 of file limits.hpp.
|
inline |
Check whether adding n and m would overflow.
Definition at line 79 of file limits.hpp.
|
inline |
Check whether adding n and m would overflow.
Definition at line 85 of file limits.hpp.
|
inline |
Check whether subtracting m from n would overflow.
Definition at line 93 of file limits.hpp.
|
inline |
Check whether subtracting m from n would overflow.
Definition at line 99 of file limits.hpp.
|
inline |
Check whether multiplying n and m would overflow.
Definition at line 107 of file limits.hpp.
|
inline |
Check whether multiplying n and m would overflow.
Definition at line 114 of file limits.hpp.
const int Gecode::Int::Limits::max = INT_MAX - 1 |
const int Gecode::Int::Limits::min = -max |
const int Gecode::Int::Limits::infinity = max + 1 |
const long long int Gecode::Int::Limits::llmax = LLONG_MAX - 1 |
const long long int Gecode::Int::Limits::llmin = -llmax |