
11 Jan
2009
11 Jan
'09
12:52 a.m.
When I create an negative mp_int outside the range of a native type and compare it to a number of that type, I get incorrect results. Here is an example to reproduce the behavior: #include <iostream> #include <limits> #include <boost/cstdint.hpp> #include <boost/mp_math/mp_int.hpp> using namespace boost::mp_math; using namespace std; int main() { int32_t MIN = numeric_limits<int32_t>::min(); mp_int<> a = MIN; cout << a << endl; a -= 1; // Should print "-2147483649 1" but prints "-2147483649 0" instead cout << a << ' ' << (a < MIN) << endl; return 0; }