Numerical limits for integer variables. More...
Functions | |
bool | valid (int n) |
Return whether n is in range. More... | |
bool | valid (long long int n) |
Return whether n is in range. More... | |
void | check (int n, const char *l) |
Check whether n is in range, otherwise throw out of limits with information l. More... | |
void | check (long long int n, const char *l) |
Check whether n is in range, otherwise throw out of limits with information l. More... | |
void | positive (int n, const char *l) |
Check whether n is in range and strictly positive, otherwise throw out of limits with information l. More... | |
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. More... | |
void | nonnegative (int n, const char *l) |
Check whether n is in range and nonnegative, otherwise throw out of limits with information l. More... | |
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. More... | |
bool | overflow_add (int n, int m) |
Check whether adding n and m would overflow. More... | |
bool | overflow_add (long long int n, long long int m) |
Check whether adding n and m would overflow. More... | |
bool | overflow_sub (int n, int m) |
Check whether subtracting m from n would overflow. More... | |
bool | overflow_sub (long long int n, long long int m) |
Check whether subtracting m from n would overflow. More... | |
bool | overflow_mul (int n, int m) |
Check whether multiplying n and m would overflow. More... | |
bool | overflow_mul (long long int n, long long int m) |
Check whether multiplying n and m would overflow. More... | |
Variables | |
const int | max = INT_MAX - 1 |
Largest allowed integer value. More... | |
const int | min = -max |
Smallest allowed integer value. More... | |
const int | infinity = max + 1 |
Infinity for integers. More... | |
const long long int | llmax = LLONG_MAX - 1 |
Largest allowed long long integer value. More... | |
const long long int | llmin = -llmax |
Smallest allowed long long integer value. More... | |
const long long int | llinfinity = llmax + 1 |
Infinity for long long integers. More... | |
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 41 of file limits.hpp.
|
inline |
Return whether n is in range.
Definition at line 45 of file limits.hpp.
|
inline |
Check whether n is in range, otherwise throw out of limits with information l.
Definition at line 50 of file limits.hpp.
|
inline |
Check whether n is in range, otherwise throw out of limits with information l.
Definition at line 55 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 61 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 66 of file limits.hpp.
|
inline |
Check whether n is in range and nonnegative, otherwise throw out of limits with information l.
Definition at line 72 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 77 of file limits.hpp.
|
inline |
Check whether adding n and m would overflow.
Definition at line 83 of file limits.hpp.
|
inline |
Check whether adding n and m would overflow.
Definition at line 89 of file limits.hpp.
|
inline |
Check whether subtracting m from n would overflow.
Definition at line 97 of file limits.hpp.
|
inline |
Check whether subtracting m from n would overflow.
Definition at line 103 of file limits.hpp.
|
inline |
Check whether multiplying n and m would overflow.
Definition at line 111 of file limits.hpp.
|
inline |
Check whether multiplying n and m would overflow.
Definition at line 118 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 |