
28 Apr
2006
28 Apr
'06
4:19 a.m.
Test Code: std::numeric_limits<long> lm; boost::rational<long> mn( lm.min() ); std::cout << mn << '=' << mn / 1 << std::endl; Output: -2147483648/1=1/0 Reason: lm.min() == -2147483648 lm.max() == 2147483647 and unary minus is not well defined for lm.min(); on my system -lm.min() == -2147483648 The problem is expected with any computer representing negative integers using binary two's compliment.